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


PHP Params::getServerParam方法代码示例

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


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

示例1: doModel


//.........这里部分代码省略.........
                 $this->redirectTo(osc_user_login_url());
             }
             $this->redirectTo(osc_user_login_url());
             break;
         case 'resend':
             $id = Params::getParam('id');
             $email = Params::getParam('email');
             $user = User::newInstance()->findByPrimaryKey($id);
             if ($id == '' || $email == '' || !isset($user) || $user['b_active'] == 1 || $email != $user['s_email']) {
                 osc_add_flash_error_message(_m('Incorrect link'));
                 $this->redirectTo(osc_user_login_url());
             }
             if (time() - strtotime($user['dt_access_date']) > 1200) {
                 // EACH 20 MINUTES
                 if (osc_notify_new_user()) {
                     osc_run_hook('hook_email_admin_new_user', $user);
                 }
                 if (osc_user_validation_enabled()) {
                     osc_run_hook('hook_email_user_validation', $user, $user);
                 }
                 User::newInstance()->update(array('dt_access_date' => date('Y-m-d H:i:s')), array('pk_i_id' => $user['pk_i_id']));
                 osc_add_flash_ok_message(_m('Validation email re-sent'));
             } else {
                 osc_add_flash_warning_message(_m('We have just sent you an email to validate your account, you will have to wait a few minutes to resend it again'));
             }
             $this->redirectTo(osc_user_login_url());
             break;
         case 'recover':
             //form to recover the password (in this case we have the form in /gui/)
             $this->doView('user-recover.php');
             break;
         case 'recover_post':
             //post execution to recover the password
             osc_csrf_check();
             require_once LIB_PATH . 'osclass/UserActions.php';
             // e-mail is incorrect
             if (!preg_match('|^[a-z0-9\\.\\_\\+\\-]+@[a-z0-9\\.\\-]+\\.[a-z]{2,3}$|i', Params::getParam('s_email'))) {
                 osc_add_flash_error_message(_m('Invalid email address'));
                 $this->redirectTo(osc_recover_user_password_url());
             }
             $userActions = new UserActions(false);
             $success = $userActions->recover_password();
             switch ($success) {
                 case 0:
                     // recover ok
                     osc_add_flash_ok_message(_m('We have sent you an email with the instructions to reset your password'));
                     $this->redirectTo(osc_base_url());
                     break;
                 case 1:
                     // e-mail does not exist
                     osc_add_flash_error_message(_m('We were not able to identify you given the information provided'));
                     $this->redirectTo(osc_recover_user_password_url());
                     break;
                 case 2:
                     // recaptcha wrong
                     osc_add_flash_error_message(_m('The recaptcha code is wrong'));
                     $this->redirectTo(osc_recover_user_password_url());
                     break;
             }
             break;
         case 'forgot':
             //form to recover the password (in this case we have the form in /gui/)
             $user = User::newInstance()->findByIdPasswordSecret(Params::getParam('userId'), Params::getParam('code'));
             if ($user) {
                 $this->doView('user-forgot_password.php');
             } else {
                 osc_add_flash_error_message(_m('Sorry, the link is not valid'));
                 $this->redirectTo(osc_base_url());
             }
             break;
         case 'forgot_post':
             osc_csrf_check();
             if (Params::getParam('new_password', false, false) == '' || Params::getParam('new_password2', false, false) == '') {
                 osc_add_flash_warning_message(_m('Password cannot be blank'));
                 $this->redirectTo(osc_forgot_user_password_confirm_url(Params::getParam('userId'), Params::getParam('code')));
             }
             $user = User::newInstance()->findByIdPasswordSecret(Params::getParam('userId'), Params::getParam('code'));
             if ($user['b_enabled'] == 1) {
                 if (Params::getParam('new_password', false, false) == Params::getParam('new_password2', false, false)) {
                     User::newInstance()->update(array('s_pass_code' => osc_genRandomPassword(50), 's_pass_date' => date('Y-m-d H:i:s', 0), 's_pass_ip' => Params::getServerParam('REMOTE_ADDR'), 's_password' => osc_hash_password(Params::getParam('new_password', false, false))), array('pk_i_id' => $user['pk_i_id']));
                     osc_add_flash_ok_message(_m('The password has been changed'));
                     $this->redirectTo(osc_user_login_url());
                 } else {
                     osc_add_flash_error_message(_m("Error, the password don't match"));
                     $this->redirectTo(osc_forgot_user_password_confirm_url(Params::getParam('userId'), Params::getParam('code')));
                 }
             } else {
                 osc_add_flash_error_message(_m('Sorry, the link is not valid'));
             }
             $this->redirectTo(osc_base_url());
             break;
         default:
             //login
             Session::newInstance()->_setReferer(osc_get_http_referer());
             if (osc_logged_user_id() != '') {
                 $this->redirectTo(osc_user_dashboard_url());
             }
             $this->doView('user-login.php');
     }
 }
开发者ID:oanav,项目名称:closetshare,代码行数:101,代码来源:login.php

示例2: __construct

 function __construct()
 {
     // this is necessary because if HTTP_HOST doesn't have the PORT the parse_url is null
     $current_host = parse_url(Params::getServerParam('HTTP_HOST'), PHP_URL_HOST);
     if ($current_host === null) {
         $current_host = Params::getServerParam('HTTP_HOST');
     }
     if (parse_url(osc_base_url(), PHP_URL_HOST) !== $current_host) {
         // first check if it's http or https
         $url = 'http://';
         if (osc_is_ssl()) {
             $url = 'https://';
         }
         // append the domain
         $url .= parse_url(osc_base_url(), PHP_URL_HOST);
         // append the port number if it's necessary
         $http_port = parse_url(Params::getServerParam('HTTP_HOST'), PHP_URL_PORT);
         if ($http_port !== 80) {
             $url .= ':' . parse_url(Params::getServerParam('HTTP_HOST'), PHP_URL_PORT);
         }
         // append the request
         $url .= Params::getServerParam('REQUEST_URI', false, false);
         $this->redirectTo($url);
     }
     $this->subdomain_params($current_host);
     $this->page = Params::getParam('page');
     $this->action = Params::getParam('action');
     $this->ajax = false;
     $this->time = list($sm, $ss) = explode(' ', microtime());
     WebThemes::newInstance();
     osc_run_hook('init');
 }
开发者ID:oanav,项目名称:closetshare,代码行数:32,代码来源:BaseModel.php

示例3: showAuthFailPage

 function showAuthFailPage()
 {
     if (Params::getParam('page') == 'ajax') {
         echo json_encode(array('error' => 1, 'msg' => __('Session timed out')));
         exit;
     } else {
         //Session::newInstance()->session_start();
         Session::newInstance()->_setReferer(osc_base_url() . preg_replace('|^' . REL_WEB_URL . '|', '', Params::getServerParam('REQUEST_URI', false, false)));
         header("Location: " . osc_admin_base_url(true) . "?page=login");
         exit;
     }
 }
开发者ID:mylastof,项目名称:os-class,代码行数:12,代码来源:AdminSecBaseModel.php

示例4: doModel

 function doModel()
 {
     $locale = Params::getParam('locale');
     if (preg_match('/.{2}_.{2}/', $locale)) {
         Session::newinstance()->_set('userLocale', $locale);
     }
     $redirect_url = '';
     if (Params::getServerParam('HTTP_REFERER', false, false) != '') {
         $redirect_url = Params::getServerParam('HTTP_REFERER', false, false);
     } else {
         $redirect_url = osc_base_url(true);
     }
     $this->redirectTo($redirect_url);
 }
开发者ID:oanav,项目名称:closetshare,代码行数:14,代码来源:language.php

示例5: basic_info

function basic_info()
{
    require_once LIB_PATH . 'osclass/model/Admin.php';
    require_once LIB_PATH . 'osclass/helpers/hSecurity.php';
    $admin = Params::getParam('s_name');
    if ($admin == '') {
        $admin = 'admin';
    }
    $password = Params::getParam('s_passwd', false, false);
    if ($password == '') {
        $password = osc_genRandomPassword();
    }
    Admin::newInstance()->insert(array('s_name' => 'Administrator', 's_username' => $admin, 's_password' => osc_hash_password($password), 's_email' => Params::getParam('email')));
    $mPreference = Preference::newInstance();
    $mPreference->insert(array('s_section' => 'osclass', 's_name' => 'pageTitle', 's_value' => Params::getParam('webtitle'), 'e_type' => 'STRING'));
    $mPreference->insert(array('s_section' => 'osclass', 's_name' => 'contactEmail', 's_value' => Params::getParam('email'), 'e_type' => 'STRING'));
    $body = sprintf(__('Hi %s,'), Params::getParam('webtitle')) . "<br/><br/>";
    $body .= sprintf(__('Your Osclass installation at %s is up and running. You can access the administration panel with these details:'), WEB_PATH) . '<br/>';
    $body .= '<ul>';
    $body .= '<li>' . sprintf(__('username: %s'), $admin) . '</li>';
    $body .= '<li>' . sprintf(__('password: %s'), $password) . '</li>';
    $body .= '</ul>';
    $body .= sprintf(__('Remember that for any doubts you might have you can consult our <a href="%1$s">documentation</a>, <a href="%2$s">forum</a> or <a href="%3$s">blog</a>.'), 'http://doc.osclass.org/', 'http://forums.osclass.org/', 'http://blog.osclass.org/');
    $body .= sprintf(' ' . __('Osclass doesn’t run any developments but we can put you in touch with third party developers through a Premium Support. And hey, if you would like to contribute to Osclass - learn how <a href="%1$s">here</a>!'), 'http://blog.osclass.org/2012/11/22/how-to-collaborate-to-osclass/') . '<br/><br/>';
    $body .= __('Cheers,') . "<br/>";
    $body .= __('The <a href="http://osclass.org/">Osclass</a> team');
    $sitename = strtolower(Params::getServerParam('SERVER_NAME'));
    if (substr($sitename, 0, 4) == 'www.') {
        $sitename = substr($sitename, 4);
    }
    try {
        require_once LIB_PATH . 'phpmailer/class.phpmailer.php';
        $mail = new PHPMailer(true);
        $mail->CharSet = "utf-8";
        $mail->Host = "localhost";
        $mail->From = 'osclass@' . $sitename;
        $mail->FromName = 'Osclass';
        $mail->Subject = 'Osclass successfully installed!';
        $mail->AddAddress(Params::getParam('email'), 'Osclass administrator');
        $mail->Body = $body;
        $mail->AltBody = $body;
        if (!$mail->Send()) {
            return array('email_status' => Params::getParam('email') . "<br>" . $mail->ErrorInfo, 's_password' => $password);
        }
        return array('email_status' => '', 's_password' => $password);
    } catch (phpmailerException $exception) {
        return array('email_status' => Params::getParam('email') . "<br>" . $exception->errorMessage(), 's_password' => $password);
    }
}
开发者ID:oanav,项目名称:closetshare,代码行数:49,代码来源:install-location.php

示例6: __construct

 /**
  *	@param	string	$blogURL			The URL of your blog.
  *	@param	string	$wordPressAPIKey	WordPress API key.
  */
 public function __construct($blogURL, $wordPressAPIKey)
 {
     $this->blogURL = $blogURL;
     $this->wordPressAPIKey = $wordPressAPIKey;
     // Set some default values
     $this->apiPort = 80;
     $this->akismetServer = 'rest.akismet.com';
     $this->akismetVersion = '1.1';
     // Start to populate the comment data
     $this->comment['blog'] = $blogURL;
     $this->comment['user_agent'] = Params::getServerParam('HTTP_USER_AGENT');
     if (Params::existServerParam('HTTP_REFERER')) {
         $this->comment['referrer'] = Params::getServerParam('HTTP_REFERER', false, false);
     }
     /* 
      * This is necessary if the server PHP5 is running on has been set up to run PHP4 and
      * PHP5 concurently and is actually running through a separate proxy al a these instructions:
      * http://www.schlitt.info/applications/blog/archives/83_How_to_run_PHP4_and_PHP_5_parallel.html
      * and http://wiki.coggeshall.org/37.html
      * Otherwise the user_ip appears as the IP address of the PHP4 server passing the requests to the 
      * PHP5 one...
      */
     $this->comment['user_ip'] = Params::getServerParam('REMOTE_ADDR') != getenv('SERVER_ADDR') ? Params::getServerParam('REMOTE_ADDR') : getenv('HTTP_X_FORWARDED_FOR');
 }
开发者ID:mylastof,项目名称:os-class,代码行数:28,代码来源:Akismet.class.php

示例7: doModel


//.........这里部分代码省略.........
                         foreach ($id as $i) {
                             if ($i) {
                                 $success = $this->itemManager->clearStat($i, 'offensive');
                                 if ($success) {
                                     $numSuccess++;
                                 }
                             }
                         }
                         osc_add_flash_ok_message(sprintf(_mn('%d listing has been unmarked as offensive', '%d listings have been unmarked as offensive', $numSuccess), $numSuccess), 'admin');
                     }
                     break;
                 case 'clear_all':
                     $id = Params::getParam('id');
                     $success = false;
                     if ($id) {
                         $numSuccess = 0;
                         foreach ($id as $i) {
                             if ($i) {
                                 $success = $this->itemManager->clearStat($i, 'all');
                                 if ($success) {
                                     $numSuccess++;
                                 }
                             }
                         }
                         osc_add_flash_ok_message(sprintf(_mn('%d listing has been unmarked', '%d listings have been unmarked', $numSuccess), $numSuccess), 'admin');
                     }
                     break;
                 default:
                     if (Params::getParam("bulk_actions") != "") {
                         osc_run_hook("item_bulk_" . Params::getParam("bulk_actions"), Params::getParam('id'));
                     }
                     break;
             }
             $this->redirectTo(Params::getServerParam('HTTP_REFERER', false, false));
             break;
         case 'delete':
             //delete
             osc_csrf_check();
             $id = Params::getParam('id');
             $success = false;
             foreach ($id as $i) {
                 if ($i) {
                     $aItem = $this->itemManager->findByPrimaryKey($i);
                     $mItems = new ItemActions(true);
                     $success = $mItems->delete($aItem['s_secret'], $aItem['pk_i_id']);
                 }
             }
             if ($success) {
                 osc_add_flash_ok_message(_m('The listing has been deleted'), 'admin');
             } else {
                 osc_add_flash_error_message(_m("The listing couldn't be deleted"), 'admin');
             }
             $this->redirectTo(Params::getServerParam('HTTP_REFERER', false, false));
             break;
         case 'status':
             //status
             osc_csrf_check();
             $id = Params::getParam('id');
             $value = Params::getParam('value');
             if (!$id) {
                 return false;
             }
             $id = (int) $id;
             if (!is_numeric($id)) {
                 return false;
             }
开发者ID:oanav,项目名称:closetshare,代码行数:67,代码来源:items.php

示例8: init

 public function init()
 {
     if (Params::existServerParam('REQUEST_URI')) {
         if (preg_match('|[\\?&]{1}http_referer=(.*)$|', urldecode(Params::getServerParam('REQUEST_URI', false, false)), $ref_match)) {
             $this->http_referer = $ref_match[1];
             $_SERVER['REQUEST_URI'] = preg_replace('|[\\?&]{1}http_referer=(.*)$|', "", urldecode(Params::getServerParam('REQUEST_URI', false, false)));
         }
         $request_uri = preg_replace('@^' . REL_WEB_URL . '@', "", urldecode(Params::getServerParam('REQUEST_URI', false, false)));
         $this->raw_request_uri = $request_uri;
         $route_used = false;
         foreach ($this->routes as $id => $route) {
             // UNCOMMENT TO DEBUG
             //echo 'Request URI: '.$request_uri." # Match : ".$route['regexp']." # URI to go : ".$route['url']." <br />";
             if (preg_match('#^' . $route['regexp'] . '#', $request_uri, $m)) {
                 if (!preg_match_all('#\\{([^\\}]+)\\}#', $route['url'], $args)) {
                     $args[1] = array();
                 }
                 $l = count($m);
                 for ($p = 1; $p < $l; $p++) {
                     if (isset($args[1][$p - 1])) {
                         Params::setParam($args[1][$p - 1], $m[$p]);
                     } else {
                         Params::setParam('route_param_' . $p, $m[$p]);
                     }
                 }
                 Params::setParam('page', 'custom');
                 Params::setParam('route', $id);
                 $route_used = true;
                 $this->location = $route['location'];
                 $this->section = $route['section'];
                 $this->title = $route['title'];
                 break;
             }
         }
         if (!$route_used) {
             if (osc_rewrite_enabled()) {
                 $tmp_ar = explode("?", $request_uri);
                 $request_uri = $tmp_ar[0];
                 // if try to access directly to a php file
                 if (preg_match('#^(.+?)\\.php(.*)$#', $request_uri)) {
                     $file = explode("?", $request_uri);
                     if (!file_exists(ABS_PATH . $file[0])) {
                         Rewrite::newInstance()->set_location('error');
                         header('HTTP/1.1 404 Not Found');
                         osc_current_web_theme_path('404.php');
                         exit;
                     }
                 }
                 foreach ($this->rules as $match => $uri) {
                     // UNCOMMENT TO DEBUG
                     // echo 'Request URI: '.$request_uri." # Match : ".$match." # URI to go : ".$uri." <br />";
                     if (preg_match('#^' . $match . '#', $request_uri, $m)) {
                         $request_uri = preg_replace('#' . $match . '#', $uri, $request_uri);
                         break;
                     }
                 }
             }
             $this->extractParams($request_uri);
             $this->request_uri = $request_uri;
             if (Params::getParam('page') != '') {
                 $this->location = Params::getParam('page');
             }
             if (Params::getParam('action') != '') {
                 $this->section = Params::getParam('action');
             }
         }
     }
 }
开发者ID:mylastof,项目名称:os-class,代码行数:68,代码来源:Rewrite.php

示例9: osc_show_pagination_admin

function osc_show_pagination_admin($aData)
{
    $pageActual = isset($aData['iPage']) ? $aData['iPage'] : Params::getParam('iPage');
    $urlActual = osc_admin_base_url(true) . '?' . Params::getServerParam('QUERY_STRING', false, false);
    $urlActual = preg_replace('/&iPage=(\\d+)?/', '', $urlActual);
    $pageTotal = ceil($aData['iTotalDisplayRecords'] / $aData['iDisplayLength']);
    $params = array('total' => $pageTotal, 'selected' => $pageActual - 1, 'url' => $urlActual . '&iPage={PAGE}', 'sides' => 5);
    ?>
    <div class="has-pagination">
        <?php 
    osc_run_hook('before_show_pagination_admin');
    ?>
        <?php 
    if ($pageTotal > 1) {
        ?>
        <form method="get" action="<?php 
        echo $urlActual;
        ?>
" style="display:inline;">
            <?php 
        foreach (Params::getParamsAsArray('get') as $key => $value) {
            ?>
            <?php 
            if ($key != 'iPage') {
                ?>
            <input type="hidden" name="<?php 
                echo osc_esc_html($key);
                ?>
" value="<?php 
                echo osc_esc_html($value);
                ?>
" />
            <?php 
            }
        }
        ?>
            <ul>
                <li>
                    <span class="list-first"><?php 
        _e('Page');
        ?>
</span>
                </li>
                <li class="pagination-input">
                    <input id="gotoPage" type="text" name="iPage" value="<?php 
        echo osc_esc_html($pageActual);
        ?>
"/><button type="submit"><?php 
        _e('Go!');
        ?>
</button>
                </li>
            </ul>
        </form>
        <?php 
        $pagination = new Pagination($params);
        $aux = $pagination->doPagination();
        echo $aux;
    }
    osc_run_hook('after_show_pagination_admin');
    ?>
    </div>
    <?php 
}
开发者ID:mylastof,项目名称:os-class,代码行数:64,代码来源:hPagination.php

示例10: doModel

 function doModel()
 {
     parent::doModel();
     //specific things for this class
     switch ($this->action) {
         case 'bulk_actions':
             osc_csrf_check();
             switch (Params::getParam('bulk_actions')) {
                 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 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:
                     if (Params::getParam("bulk_actions") != "") {
                         osc_run_hook("media_bulk_" . Params::getParam("bulk_actions"), Params::getParam('id'));
                     }
                     break;
             }
             $this->redirectTo(osc_admin_base_url(true) . '?page=media');
             break;
         case 'delete':
             osc_csrf_check();
             $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:
             require_once osc_lib_path() . "osclass/classes/datatables/MediaDataTable.php";
             // set default iDisplayLength
             if (Params::getParam('iDisplayLength') != '') {
                 Cookie::newInstance()->push('listing_iDisplayLength', Params::getParam('iDisplayLength'));
                 Cookie::newInstance()->set();
             } else {
                 // set a default value if it's set in the cookie
                 if (Cookie::newInstance()->get_value('listing_iDisplayLength') != '') {
                     Params::setParam('iDisplayLength', Cookie::newInstance()->get_value('listing_iDisplayLength'));
                 } else {
                     Params::setParam('iDisplayLength', 10);
                 }
             }
             $this->_exportVariableToView('iDisplayLength', Params::getParam('iDisplayLength'));
             // Table header order by related
             if (Params::getParam('sort') == '') {
                 Params::setParam('sort', 'date');
             }
             if (Params::getParam('direction') == '') {
                 Params::setParam('direction', 'desc');
             }
             $page = (int) Params::getParam('iPage');
             if ($page == 0) {
                 $page = 1;
             }
             Params::setParam('iPage', $page);
             $params = Params::getParamsAsArray();
             $mediaDataTable = new MediaDataTable();
             $mediaDataTable->table($params);
             $aData = $mediaDataTable->getData();
             if (count($aData['aRows']) == 0 && $page != 1) {
                 $total = (int) $aData['iTotalDisplayRecords'];
                 $maxPage = ceil($total / (int) $aData['iDisplayLength']);
                 $url = osc_admin_base_url(true) . '?' . Params::getServerParam('QUERY_STRING', false, false);
                 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('aData', $aData);
             $this->_exportVariableToView('aRawRows', $mediaDataTable->rawRows());
             $bulk_options = array(array('value' => '', 'data-dialog-content' => '', 'label' => __('Bulk actions')), array('value' => 'delete', 'data-dialog-content' => sprintf(__('Are you sure you want to %s the selected media files?'), strtolower(__('Delete'))), 'label' => __('Delete')));
             $bulk_options = osc_apply_filter("media_bulk_filter", $bulk_options);
             $this->_exportVariableToView('bulk_options', $bulk_options);
             $this->doView('media/index.php');
             break;
     }
 }
开发者ID:oanav,项目名称:closetshare,代码行数:95,代码来源:media.php

示例11: doModel


//.........这里部分代码省略.........
             $s_internal_name = Params::getParam("s_internal_name");
             $aFieldsDescription = array();
             $postParams = Params::getParamsAsArray('', false);
             $not_empty = false;
             foreach ($postParams as $k => $v) {
                 if (preg_match('|(.+?)#(.+)|', $k, $m)) {
                     if ($m[2] == 's_title' && $v != '') {
                         $not_empty = true;
                     }
                     $aFieldsDescription[$m[1]][$m[2]] = $v;
                 }
             }
             Session::newInstance()->_setForm('s_internal_name', $s_internal_name);
             Session::newInstance()->_setForm('aFieldsDescription', $aFieldsDescription);
             if ($not_empty) {
                 foreach ($aFieldsDescription as $k => $_data) {
                     $this->emailManager->updateDescription($id, $k, $_data['s_title'], $_data['s_text']);
                 }
                 if (!$this->emailManager->internalNameExists($id, $s_internal_name)) {
                     if (!$this->emailManager->isIndelible($id)) {
                         $this->emailManager->updateInternalName($id, $s_internal_name);
                     }
                     Session::newInstance()->_clearVariables();
                     osc_add_flash_ok_message(_m('The email/alert has been updated'), 'admin');
                     $this->redirectTo(osc_admin_base_url(true) . "?page=emails");
                 }
                 osc_add_flash_error_message(_m('You can\'t repeat internal name'), 'admin');
             } else {
                 osc_add_flash_error_message(_m('The email couldn\'t be updated, at least one title should not be empty'), 'admin');
             }
             $this->redirectTo(osc_admin_base_url(true) . "?page=emails&action=edit&id=" . $id);
             break;
         default:
             //-
             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);
             $prefLocale = osc_current_admin_locale();
             $emails = $this->emailManager->listAll(1);
             // pagination
             $start = ($p_iPage - 1) * Params::getParam('iDisplayLength');
             $limit = Params::getParam('iDisplayLength');
             $count = count($emails);
             $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++) {
                 $email = $emails[$i];
                 if (isset($email['locale'][$prefLocale]) && !empty($email['locale'][$prefLocale]['s_title'])) {
                     $title = $email['locale'][$prefLocale];
                 } else {
                     $title = current($email['locale']);
                 }
                 $options = array();
                 $options[] = '<a href="' . osc_admin_base_url(true) . '?page=emails&amp;action=edit&amp;id=' . $email["pk_i_id"] . '">' . __('Edit') . '</a>';
                 $auxOptions = '<ul>' . PHP_EOL;
                 foreach ($options as $actual) {
                     $auxOptions .= '<li>' . $actual . '</li>' . PHP_EOL;
                 }
                 $actions = '<div class="actions">' . $auxOptions . '</div>' . PHP_EOL;
                 $row = array();
                 $row[] = $email['s_internal_name'] . $actions;
                 $row[] = $title['s_title'];
                 $aData[] = $row;
             }
             // ----
             $array['iTotalRecords'] = $displayRecords;
             $array['iTotalDisplayRecords'] = count($emails);
             $array['iDisplayLength'] = $limit;
             $array['aaData'] = $aData;
             $page = (int) Params::getParam('iPage');
             if (count($array['aaData']) == 0 && $page != 1) {
                 $total = (int) $array['iTotalDisplayRecords'];
                 $maxPage = ceil($total / (int) $array['iDisplayLength']);
                 $url = osc_admin_base_url(true) . '?' . Params::getServerParam('QUERY_STRING', false, false);
                 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('aEmails', $array);
             $this->doView("emails/index.php");
     }
 }
开发者ID:mylastof,项目名称:os-class,代码行数:101,代码来源:emails.php

示例12: recover_password

 function recover_password()
 {
     $user = User::newInstance()->findByEmail(Params::getParam('s_email'));
     Session::newInstance()->_set('recover_time', time());
     if (osc_recaptcha_private_key() != '') {
         if (!osc_check_recaptcha()) {
             return 2;
             // BREAK THE PROCESS, THE RECAPTCHA IS WRONG
         }
     }
     if (!$user || $user['b_enabled'] == 0) {
         return 1;
     }
     $code = osc_genRandomPassword(30);
     $date = date('Y-m-d H:i:s');
     User::newInstance()->update(array('s_pass_code' => $code, 's_pass_date' => $date, 's_pass_ip' => Params::getServerParam('REMOTE_ADDR')), array('pk_i_id' => $user['pk_i_id']));
     $password_url = osc_forgot_user_password_confirm_url($user['pk_i_id'], $code);
     osc_run_hook('hook_email_user_forgot_password', $user, $password_url);
     return 0;
 }
开发者ID:oanav,项目名称:closetshare,代码行数:20,代码来源:UserActions.php

示例13: get_ip

function get_ip()
{
    if (Params::getServerParam('HTTP_CLIENT_IP') != '') {
        return Params::getServerParam('HTTP_CLIENT_IP');
    }
    if (Params::getServerParam('HTTP_X_FORWARDED_FOR') != '') {
        $ip_array = explode(',', Params::getServerParam('HTTP_X_FORWARDED_FOR'));
        foreach ($ip_array as $ip) {
            return trim($ip);
        }
    }
    return Params::getServerParam('REMOTE_ADDR');
}
开发者ID:adrienrn,项目名称:Osclass,代码行数:13,代码来源:utils.php

示例14: doModel


//.........这里部分代码省略.........
                             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>';
                 $options[] = '<a href="' . osc_admin_base_url(true) . '?page=languages&amp;action=' . ($l['b_enabled'] == 1 ? 'disable_selected' : 'enable_selected') . '&amp;id[]=' . $l['pk_c_code'] . '&amp;' . osc_csrf_token_url() . '">' . ($l['b_enabled'] == 1 ? __('Disable (website)') : __('Enable (website)')) . '</a> ';
                 $options[] = '<a href="' . osc_admin_base_url(true) . '?page=languages&amp;action=' . ($l['b_enabled_bo'] == 1 ? 'disable_bo_selected' : 'enable_bo_selected') . '&amp;id[]=' . $l['pk_c_code'] . '&amp;' . osc_csrf_token_url() . '">' . ($l['b_enabled_bo'] == 1 ? __('Disable (oc-admin)') : __('Enable (oc-admin)')) . '</a>';
                 $options[] = '<a onclick="return delete_dialog(\'' . $l['pk_c_code'] . '\');"  href="' . osc_admin_base_url(true) . '?page=languages&amp;action=delete&amp;id[]=' . $l['pk_c_code'] . '&amp;' . osc_csrf_token_url() . '">' . __('Delete') . '</a>';
                 $auxOptions = '<ul>' . PHP_EOL;
                 foreach ($options as $actual) {
                     $auxOptions .= '<li>' . $actual . '</li>' . PHP_EOL;
                 }
                 $actions = '<div class="actions">' . $auxOptions . '</div>' . PHP_EOL;
                 $sUpdate = '';
                 // get languages to update from t_preference
                 if ($bLanguagesToUpdate) {
                     if (in_array($l['pk_c_code'], $aLanguagesToUpdate)) {
                         $sUpdate = '<a class="btn-market-update btn-market-popup" href="#' . htmlentities($l['pk_c_code']) . '">' . __("Update here") . '</a>';
                     }
                 }
                 $row[] = $l['s_name'] . $sUpdate . $actions;
                 $row[] = $l['s_short_name'];
                 $row[] = $l['s_description'];
                 $row[] = $l['b_enabled'] ? __('Yes') : __('No');
                 $row[] = $l['b_enabled_bo'] ? __('Yes') : __('No');
                 $aData[] = $row;
             }
             // ----
             $array['iTotalRecords'] = $displayRecords;
             $array['iTotalDisplayRecords'] = count($aLanguages);
             $array['iDisplayLength'] = $limit;
             $array['aaData'] = $aData;
             $page = (int) Params::getParam('iPage');
             if (count($array['aaData']) == 0 && $page != 1) {
                 $total = (int) $array['iTotalDisplayRecords'];
                 $maxPage = ceil($total / (int) $array['iDisplayLength']);
                 $url = osc_admin_base_url(true) . '?' . Params::getServerParam('QUERY_STRING', false, false);
                 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('aLanguages', $array);
             $bulk_options = array(array('value' => '', 'data-dialog-content' => '', 'label' => __('Bulk actions')), array('value' => 'enable_selected', 'data-dialog-content' => sprintf(__('Are you sure you want to %s the selected languages?'), strtolower(__('Enable (Website)'))), 'label' => __('Enable (Website)')), array('value' => 'disable_selected', 'data-dialog-content' => sprintf(__('Are you sure you want to %s the selected languages?'), strtolower(__('Disable (Website)'))), 'label' => __('Disable (Website)')), array('value' => 'enable_bo_selected', 'data-dialog-content' => sprintf(__('Are you sure you want to %s the selected languages?'), strtolower(__('Enable (oc-admin)'))), 'label' => __('Enable (oc-admin)')), array('value' => 'disable_bo_selected', 'data-dialog-content' => sprintf(__('Are you sure you want to %s the selected languages?'), strtolower(__('Disable (oc-admin)'))), 'label' => __('Disable (oc-admin)')), array('value' => 'delete', 'data-dialog-content' => sprintf(__('Are you sure you want to %s the selected languages?'), strtolower(__('Delete'))), 'label' => __('Delete')));
             $bulk_options = osc_apply_filter("language_bulk_filter", $bulk_options);
             $this->_exportVariableToView('bulk_options', $bulk_options);
             $this->doView('languages/index.php');
             break;
     }
 }
开发者ID:oanav,项目名称:closetshare,代码行数:101,代码来源:languages.php

示例15: osc_is_banned

/**
 * Check is an email and IP are banned
 *
 * @param string $email
 * @param string $ip
 * @since 3.1
 * @return int 0: not banned, 1: email is banned, 2: IP is banned
 */
function osc_is_banned($email = '', $ip = null)
{
    if ($ip == null) {
        $ip = Params::getServerParam('REMOTE_ADDR');
    }
    $rules = BanRule::newInstance()->listAll();
    if (!osc_is_ip_banned($ip, $rules)) {
        if ($email != '') {
            return osc_is_email_banned($email, $rules) ? 1 : 0;
            // 1:Email is banned, 0:not banned
        }
        return 0;
    }
    return 2;
    //IP is banned
}
开发者ID:mylastof,项目名称:os-class,代码行数:24,代码来源:hSecurity.php


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