• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP osc_sanitizeString函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中osc_sanitizeString函数的典型用法代码示例。如果您正苦于以下问题:PHP osc_sanitizeString函数的具体用法?PHP osc_sanitizeString怎么用?PHP osc_sanitizeString使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: getItemUrl

 public static function getItemUrl(&$item)
 {
     $gn_id = $item['gn_id'];
     $gn_title = $item['gn_title'];
     $friendly_title = osc_sanitizeString(osc_apply_filter('slug', $gn_title));
     $item_url = GZ_NEWS_URL . 'pages/item.php';
     if (self::isModRewriteEnabled()) {
         $item_url = osc_base_url() . "news/read/{$gn_id}/{$friendly_title}.html";
     } else {
         $item_url = $item_url . "?i={$gn_id}&title={$friendly_title}";
     }
     return $item_url;
 }
开发者ID:faosclass,项目名称:gz_news,代码行数:13,代码来源:GzNewsUtils.php


示例2: insert

 public function insert($fields, $aFieldsDescription = null)
 {
     $columns = implode(', ', array_keys($fields));
     $set = "";
     foreach ($fields as $value) {
         if ($set != "") {
             $set .= ", ";
         }
         $set .= $this->formatValue($value);
     }
     $sql = 'INSERT INTO ' . $this->getTableName() . ' (' . $columns . ') VALUES (' . $set . ')';
     $this->conn->osc_dbExec($sql);
     $category_id = $this->conn->get_last_id();
     foreach ($aFieldsDescription as $k => $fieldsDescription) {
         $fieldsDescription['fk_i_category_id'] = $category_id;
         $fieldsDescription['fk_c_locale_code'] = $k;
         $fieldsDescription['s_slug'] = osc_sanitizeString(osc_apply_filter('slug', $fieldsDescription['s_name']));
         $columns = implode(', ', array_keys($fieldsDescription));
         $set = "";
         foreach ($fieldsDescription as $value) {
             if ($set != "") {
                 $set .= ", ";
             }
             $set .= $this->formatValue($value);
         }
         $sql = 'INSERT INTO ' . $this->getTableDescriptionName() . ' (' . $columns . ') VALUES (' . $set . ')';
         $this->conn->osc_dbExec($sql);
     }
 }
开发者ID:hashemgamal,项目名称:OSClass,代码行数:29,代码来源:Category.php


示例3: osc_list_city_url

/**
 * Gets the url of current "list city""
 *
 * @return string
 */
function osc_list_city_url()
{
    if (osc_rewrite_enabled()) {
        $url = osc_base_url();
        if (osc_get_preference('seo_url_search_prefix') != '') {
            $url .= osc_get_preference('seo_url_search_prefix') . '/';
        }
        $url .= osc_sanitizeString(osc_list_city_name()) . '-c' . osc_list_city_id();
        return $url;
    } else {
        return osc_search_url(array('sCity' => osc_list_city_id()));
    }
}
开发者ID:jmcclenon,项目名称:Osclass,代码行数:18,代码来源:hSearch.php


示例4: osc_search_url


//.........这里部分代码省略.........
                    $url = str_replace('{CATEGORIES}', implode("/", $sanitized_categories), $url);
                }
                $seo_prefix = '';
                if (osc_get_preference('seo_url_search_prefix') != '') {
                    $seo_prefix = osc_get_preference('seo_url_search_prefix') . '/';
                }
                $url = str_replace('{CATEGORY_NAME}', $category['s_slug'], $url);
                // DEPRECATED : CATEGORY_SLUG is going to be removed in 3.4
                $url = str_replace('{CATEGORY_SLUG}', $category['s_slug'], $url);
                $url = str_replace('{CATEGORY_ID}', $category['pk_i_id'], $url);
            } else {
                // Search by a category which does not exists (by form)
                // TODO CHANGE TO NEW ROUTES!!
                return $base_url . 'index.php?page=search&sCategory=' . urlencode($params['sCategory']);
            }
            if (isset($params['iPage']) && $params['iPage'] != '' && $params['iPage'] != 1) {
                $url .= '/' . $params['iPage'];
            }
            $url = $base_url . $seo_prefix . $url;
        } else {
            if (isset($params['sRegion']) && is_string($params['sRegion']) && strpos($params['sRegion'], ',') === false && ($countP == 1 || $countP == 2 && (isset($params['iPage']) || isset($params['sCategory'])) || $countP == 3 && isset($params['iPage']) && isset($params['sCategory']))) {
                $url = $base_url;
                if (osc_get_preference('seo_url_search_prefix') != '') {
                    $url .= osc_get_preference('seo_url_search_prefix') . '/';
                }
                if (isset($params['sCategory'])) {
                    $_auxSlug = _aux_search_category_slug($params['sCategory']);
                    if ($_auxSlug != '') {
                        $url .= $_auxSlug . '_';
                    }
                }
                if (isset($params['sRegion'])) {
                    if (osc_list_region_id() == $params['sRegion']) {
                        $url .= osc_sanitizeString(osc_list_region_slug()) . '-r' . osc_list_region_id();
                    } else {
                        if (is_numeric($params['sRegion'])) {
                            $region = Region::newInstance()->findByPrimaryKey($params['sRegion']);
                        } else {
                            $region = Region::newInstance()->findByName($params['sRegion']);
                        }
                        if (isset($region['s_slug'])) {
                            $url .= osc_sanitizeString($region['s_slug']) . '-r' . $region['pk_i_id'];
                        } else {
                            // Search by a region which does not exists (by form)
                            // TODO CHANGE TO NEW ROUTES!!
                            return $url . 'index.php?page=search&sRegion=' . urlencode($params['sRegion']);
                        }
                    }
                }
                if (isset($params['iPage']) && $params['iPage'] != '' && $params['iPage'] != 1) {
                    $url .= '/' . $params['iPage'];
                }
            } else {
                if (isset($params['sCity']) && !is_array($params['sCity']) && strpos($params['sCity'], ',') === false && ($countP == 1 || $countP == 2 && (isset($params['iPage']) || isset($params['sCategory'])) || $countP == 3 && isset($params['iPage']) && isset($params['sCategory']))) {
                    $url = $base_url;
                    if (osc_get_preference('seo_url_search_prefix') != '') {
                        $url .= osc_get_preference('seo_url_search_prefix') . '/';
                    }
                    if (isset($params['sCategory'])) {
                        $_auxSlug = _aux_search_category_slug($params['sCategory']);
                        if ($_auxSlug != '') {
                            $url .= $_auxSlug . '_';
                        }
                    }
                    if (isset($params['sCity'])) {
                        if (osc_list_city_id() == $params['sCity']) {
开发者ID:mylastof,项目名称:os-class,代码行数:67,代码来源:hSearch.php


示例5: osc_premium_url

/**
 * Create automatically the url of the item details page
 *
 * @param string $locale
 * @return string
 */
function osc_premium_url($locale = '')
{
    if (osc_rewrite_enabled()) {
        $sanitized_categories = array();
        $cat = Category::newInstance()->hierarchy(osc_premium_category_id());
        for ($i = count($cat); $i > 0; $i--) {
            $sanitized_categories[] = $cat[$i - 1]['s_slug'];
        }
        $url = str_replace('{CATEGORIES}', implode("/", $sanitized_categories), str_replace('{ITEM_ID}', osc_premium_id(), str_replace('{ITEM_TITLE}', osc_sanitizeString(osc_premium_title()), osc_get_preference('rewrite_item_url'))));
        if ($locale != '') {
            $path = osc_base_url() . $locale . "/" . $url;
        } else {
            $path = osc_base_url() . $url;
        }
    } else {
        $path = osc_item_url_ns(osc_premium_id(), $locale);
    }
    return $path;
}
开发者ID:randomecho,项目名称:OSClass,代码行数:25,代码来源:hDefines.php


示例6: doModel

 function doModel()
 {
     parent::doModel();
     //specific things for this class
     switch ($this->action) {
         case 'edit':
             if (Params::getParam("id") == '') {
                 $this->redirectTo(osc_admin_base_url(true) . "?page=pages");
             }
             $this->_exportVariableToView("page", $this->pageManager->findByPrimaryKey(Params::getParam("id")));
             $this->doView("pages/frm.php");
             break;
         case 'edit_post':
             $id = Params::getParam("id");
             $s_internal_name = Params::getParam("s_internal_name");
             // sanitize internal name
             $s_internal_name = osc_sanitizeString($s_internal_name);
             if (!WebThemes::newInstance()->isValidPage($s_internal_name)) {
                 osc_add_flash_error_message(_m('You have to set a different internal name'), 'admin');
                 $this->redirectTo(osc_admin_base_url(true) . "?page=pages?action=edit&id=" . $id);
             }
             $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;
                 }
             }
             if ($not_empty) {
                 foreach ($aFieldsDescription as $k => $_data) {
                     $this->pageManager->updateDescription($id, $k, $_data['s_title'], $_data['s_text']);
                 }
                 if (!$this->pageManager->internalNameExists($id, $s_internal_name)) {
                     if (!$this->pageManager->isIndelible($id)) {
                         $this->pageManager->updateInternalName($id, $s_internal_name);
                     }
                     osc_add_flash_ok_message(_m('The page has been updated'), 'admin');
                     $this->redirectTo(osc_admin_base_url(true) . "?page=pages");
                 }
                 osc_add_flash_error_message(_m("You can't repeat internal name"), 'admin');
             } else {
                 osc_add_flash_error_message(_m("The page couldn't be updated, at least one title should not be empty"), 'admin');
             }
             $this->redirectTo(osc_admin_base_url(true) . "?page=pages?action=edit&id=" . $id);
             break;
         case 'add':
             $this->_exportVariableToView("page", array());
             $this->doView("pages/frm.php");
             break;
         case 'add_post':
             // setForm just in case the form fails
             foreach (Params::getParamsAsArray('', false) as $k => $v) {
                 Session::newInstance()->_setForm($k, $v);
             }
             $s_internal_name = Params::getParam("s_internal_name");
             // sanitize internal name
             $s_internal_name = osc_sanitizeString($s_internal_name);
             if ($s_internal_name == '') {
                 osc_add_flash_error_message(_m('You have to set an internal name'), 'admin');
                 $this->redirectTo(osc_admin_base_url(true) . "?page=pages&action=add");
             }
             if (!WebThemes::newInstance()->isValidPage($s_internal_name)) {
                 osc_add_flash_error_message(_m('You have to set a different internal name'), 'admin');
                 $this->redirectTo(osc_admin_base_url(true) . "?page=pages&action=add");
             }
             $page = $this->pageManager->findByInternalName($s_internal_name);
             if (!isset($page['pk_i_id'])) {
                 $aFields = array('s_internal_name' => $s_internal_name, 'b_indelible' => '0');
                 $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;
                     }
                 }
                 if ($not_empty) {
                     $result = $this->pageManager->insert($aFields, $aFieldsDescription);
                     osc_add_flash_ok_message(_m('The page has been added'), 'admin');
                 } else {
                     osc_add_flash_error_message(_m("The page couldn't be added, at least one title should not be empty"), 'admin');
                 }
             } else {
                 osc_add_flash_error_message(_m("Oops! That internal name is already in use. We can't made the changes"), 'admin');
             }
             $this->redirectTo(osc_admin_base_url(true) . "?page=pages");
             break;
         case 'delete':
             $id = Params::getParam("id");
             $page_deleted_correcty = 0;
             $page_deleted_error = 0;
             $page_indelible = 0;
             if (!is_array($id)) {
//.........这里部分代码省略.........
开发者ID:randomecho,项目名称:OSClass,代码行数:101,代码来源:pages.php


示例7: insert

 /**
  * Inser a new category
  *
  * @access public
  * @since unknown
  * @param array $fields
  * @param array $aFieldsDescriptions
  */
 public function insert($fields, $aFieldsDescription = null)
 {
     $this->dao->insert($this->getTableName(), $fields);
     $category_id = $this->dao->insertedId();
     foreach ($aFieldsDescription as $k => $fieldsDescription) {
         $fieldsDescription['fk_i_category_id'] = $category_id;
         $fieldsDescription['fk_c_locale_code'] = $k;
         $slug_tmp = $slug = osc_sanitizeString(osc_apply_filter('slug', $fieldsDescription['s_name']));
         $slug_unique = 1;
         while (true) {
             if (!$this->findBySlug($slug)) {
                 break;
             } else {
                 $slug = $slug_tmp . "_" . $slug_unique;
                 $slug_unique++;
             }
         }
         $fieldsDescription['s_slug'] = $slug;
         $this->dao->insert(DB_TABLE_PREFIX . 't_category_description', $fieldsDescription);
     }
     return $category_id;
 }
开发者ID:oanav,项目名称:closetshare,代码行数:30,代码来源:Category.php


示例8: osc_sanitize_string

/**
 * Sanitize a string.
 *
 * @param string $value value to sanitize
 * @return string sanitized
 */
function osc_sanitize_string($value)
{
    return osc_sanitizeString($value);
}
开发者ID:mylastof,项目名称:os-class,代码行数:10,代码来源:hSanitize.php


示例9: osc_calculate_location_slug

function osc_calculate_location_slug($type)
{
    $field = 'pk_i_id';
    switch ($type) {
        case 'country':
            $manager = Country::newInstance();
            $field = 'pk_c_code';
            break;
        case 'region':
            $manager = Region::newInstance();
            break;
        case 'city':
            $manager = City::newInstance();
            break;
        default:
            return false;
            break;
    }
    $locations = $manager->listByEmptySlug();
    $locations_changed = 0;
    foreach ($locations as $location) {
        $slug_tmp = $slug = osc_sanitizeString($location['s_name']);
        $slug_unique = 1;
        while (true) {
            $location_slug = $manager->findBySlug($slug);
            if (!isset($location_slug[$field])) {
                break;
            } else {
                $slug = $slug_tmp . '-' . $slug_unique;
                $slug_unique++;
            }
        }
        $locations_changed += $manager->update(array('s_slug' => $slug), array($field => $location[$field]));
    }
    return $locations_changed;
}
开发者ID:naneri,项目名称:Osclass,代码行数:36,代码来源:utils.php


示例10: osc_item_url

/**
 * Create automatically the url of the item details page
 *
 * @return string
 */
function osc_item_url($locale = '')
{
    if (osc_rewrite_enabled()) {
        $sanitized_title = osc_sanitizeString(osc_item_title());
        $sanitized_category = '';
        $cat = Category::newInstance()->hierarchy(osc_item_category_id());
        for ($i = count($cat); $i > 0; $i--) {
            $sanitized_category .= $cat[$i - 1]['s_slug'] . '/';
        }
        if ($locale != '') {
            $path = osc_base_url() . sprintf('%s_%s%s_%d', $locale, $sanitized_category, $sanitized_title, osc_item_id());
        } else {
            $path = osc_base_url() . sprintf('%s%s_%d', $sanitized_category, $sanitized_title, osc_item_id());
        }
    } else {
        //$path = osc_base_url(true) . sprintf('?page=item&id=%d', osc_item_id()) ;
        $path = osc_item_url_ns(osc_item_id(), $locale);
    }
    return $path;
}
开发者ID:hashemgamal,项目名称:OSClass,代码行数:25,代码来源:hDefines.php


示例11: doModel

        function doModel()
        {
            // calling the locations settings view
            $location_action = Params::getParam('type');
            $mCountries = new Country();

            switch ($location_action) {
                case('add_country'):    // add country
                                        if( defined('DEMO') ) {
                                            osc_add_flash_warning_message( _m("This action can't be done because it's a demo site"), 'admin');
                                            $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=locations');
                                        }
                                        osc_csrf_check();
                                        $countryCode = strtoupper(Params::getParam('c_country'));
                                        $countryName = Params::getParam('country');
                                        $exists = $mCountries->findByCode($countryCode);
                                        if(isset($exists['s_name'])) {
                                            osc_add_flash_error_message(sprintf(_m('%s already was in the database'), $countryName), 'admin');
                                        } else {
                                            if(Params::getParam('c_manual')==1) {
                                                $mCountries->insert(array('pk_c_code' => $countryCode,
                                                                        's_name' => $countryName));
                                                osc_add_flash_ok_message(sprintf(_m('%s has been added as a new country'), $countryName), 'admin');
                                            } else {
                                                if(!osc_validate_min($countryCode, 1) || !osc_validate_min($countryName, 1)) {
                                                    osc_add_flash_error_message(_m('Country code and name should have at least two characters'), 'admin');
                                                } else {
                                                    $data_sql = osc_file_get_contents('http://geo.osclass.org/newgeo.download.php?action=country&term=' . urlencode($countryCode) );

                                                    if($data_sql!='') {
                                                        $conn = DBConnectionClass::newInstance();
                                                        $c_db = $conn->getOsclassDb();
                                                        $comm = new DBCommandClass($c_db);
                                                        $comm->query("SET FOREIGN_KEY_CHECKS = 0");
                                                        $comm->importSQL($data_sql);
                                                        $comm->query("SET FOREIGN_KEY_CHECKS = 1");
                                                    } else {
                                                        $mCountries->insert(array('pk_c_code' => $countryCode,
                                                                                's_name' => $countryName));
                                                    }
                                                    osc_add_flash_ok_message(sprintf(_m('%s has been added as a new country'), $countryName), 'admin');
                                                }
                                            }
                                        }
                                        osc_calculate_location_slug(osc_subdomain_type());
                                        $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=locations');
                break;
                case('edit_country'):   // edit country
                                        if( defined('DEMO') ) {
                                            osc_add_flash_warning_message( _m("This action can't be done because it's a demo site"), 'admin');
                                            $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=locations');
                                        }
                                        osc_csrf_check();
                                        if(!osc_validate_min(Params::getParam('e_country'), 1)) {
                                            osc_add_flash_error_message(_m('Country name cannot be blank'), 'admin');
                                        } else {
                                            $name = Params::getParam('e_country');
                                            $slug = Params::getParam('e_country_slug');
                                            if($slug=='') {
                                                $slug_tmp = $slug = osc_sanitizeString($name);
                                            } else {
                                                $exists = $mCountries->findBySlug($slug);
                                                if(isset($exists['s_slug']) && $exists['pk_c_code']!=Params::getParam('country_code')) {
                                                    $slug_tmp = $slug = osc_sanitizeString($name);
                                                } else {
                                                    $slug_tmp = $slug = osc_sanitizeString($slug);
                                                }
                                            }
                                            $slug_unique = 1;
                                            while(true) {
                                                $location_slug = $mCountries->findBySlug($slug);
                                                if(isset($location_slug['s_slug']) && $location_slug['pk_c_code']!=Params::getParam('country_code')) {
                                                    $slug = $slug_tmp . '-' . $slug_unique;
                                                    $slug_unique++;
                                                } else {
                                                    break;
                                                }
                                            }

                                            $ok = $mCountries->update(array('s_name'=> $name, 's_slug' => $slug), array('pk_c_code' => Params::getParam('country_code')));

                                            if( $ok ) {
                                                osc_add_flash_ok_message(_m('Country has been edited'), 'admin');
                                            } else {
                                                osc_add_flash_error_message(_m('There were some problems editing the country'), 'admin');
                                            }
                                        }
                                        $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=locations');
                break;
                case('delete_country'): // delete country
                                        if( defined('DEMO') ) {
                                            osc_add_flash_warning_message( _m("This action can't be done because it's a demo site"), 'admin');
                                            $this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=locations');
                                        }
                                        osc_csrf_check();
                                        $countryIds = Params::getParam('id');

                                        if(is_array($countryIds)) {
                                            $locations = 0;
                                            $del_locations = 0;
//.........这里部分代码省略.........
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:101,代码来源:locations.php


示例12: osc_footer_link_url

function osc_footer_link_url()
{
    $f = View::newInstance()->_get('footer_link');
    $url = osc_base_url();
    if (osc_get_preference('seo_url_search_prefix') != '') {
        $url .= osc_get_preference('seo_url_search_prefix') . '/';
    }
    $bCategory = false;
    if (osc_search_category_id()) {
        $bCategory = true;
        $cat = osc_get_category('id', $f['fk_i_category_id']);
        $url .= $cat['s_slug'] . '_';
    }
    if (osc_search_region() == '') {
        $url .= osc_sanitizeString($f['s_region']) . '-r' . $f['fk_i_region_id'];
    } else {
        $url .= osc_sanitizeString($f['s_city']) . '-c' . $f['fk_i_city_id'];
    }
    return $url;
}
开发者ID:jmcclenon,项目名称:Osclass,代码行数:20,代码来源:functions.php


示例13: doModel

 function doModel()
 {
     parent::doModel();
     //specific things for this class
     switch ($this->action) {
         case 'edit':
             if (Params::getParam("id") == '') {
                 $this->redirectTo(osc_admin_base_url(true) . "?page=pages");
             }
             $form = count(Session::newInstance()->_getForm());
             $keepForm = count(Session::newInstance()->_getKeepForm());
             if ($form == 0 || $form == $keepForm) {
                 Session::newInstance()->_dropKeepForm();
             }
             $templates = osc_apply_filter('page_templates', WebThemes::newInstance()->getAvailableTemplates());
             $this->_exportVariableToView('templates', $templates);
             $this->_exportVariableToView("page", $this->pageManager->findByPrimaryKey(Params::getParam("id")));
             $this->doView("pages/frm.php");
             break;
         case 'edit_post':
             osc_csrf_check();
             $id = Params::getParam("id");
             $b_link = Params::getParam("b_link") != '' ? 1 : 0;
             $s_internal_name = Params::getParam("s_internal_name");
             $s_internal_name = osc_sanitizeString($s_internal_name);
             $meta = Params::getParam('meta');
             $this->pageManager->updateMeta($id, json_encode($meta));
             $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('aFieldsDescription', $aFieldsDescription);
             if ($s_internal_name == '') {
                 osc_add_flash_error_message(_m('You have to set an internal name'), 'admin');
                 $this->redirectTo(osc_admin_base_url(true) . "?page=pages&action=edit&id=" . $id);
             }
             if (!WebThemes::newInstance()->isValidPage($s_internal_name)) {
                 osc_add_flash_error_message(_m('You have to set a different internal name'), 'admin');
                 $this->redirectTo(osc_admin_base_url(true) . "?page=pages&action=edit&id=" . $id);
             }
             Session::newInstance()->_setForm('s_internal_name', $s_internal_name);
             if ($not_empty) {
                 foreach ($aFieldsDescription as $k => $_data) {
                     $this->pageManager->updateDescription($id, $k, $_data['s_title'], $_data['s_text']);
                 }
                 if (!$this->pageManager->internalNameExists($id, $s_internal_name)) {
                     if (!$this->pageManager->isIndelible($id)) {
                         $this->pageManager->updateInternalName($id, $s_internal_name);
                         $this->pageManager->updateLink($id, $b_link);
                     }
                     osc_run_hook('edit_page', $id);
                     Session::newInstance()->_clearVariables();
                     osc_add_flash_ok_message(_m('The page has been updated'), 'admin');
                     $this->redirectTo(osc_admin_base_url(true) . "?page=pages");
                 }
                 osc_add_flash_error_message(_m("You can't repeat internal name"), 'admin');
             } else {
                 osc_add_flash_error_message(_m("The page couldn't be updated, at least one title should not be empty"), 'admin');
             }
             $this->redirectTo(osc_admin_base_url(true) . "?page=pages&action=edit&id=" . $id);
             break;
         case 'add':
             $form = count(Session::newInstance()->_getForm());
             $keepForm = count(Session::newInstance()->_getKeepForm());
             if ($form == 0 || $form == $keepForm) {
                 Session::newInstance()->_dropKeepForm();
             }
             $templates = osc_apply_filter('page_templates', WebThemes::newInstance()->getAvailableTemplates());
             $this->_exportVariableToView('templates', $templates);
             $this->_exportVariableToView("page", array());
             $this->doView("pages/frm.php");
             break;
         case 'add_post':
             osc_csrf_check();
             $s_internal_name = Params::getParam("s_internal_name");
             $b_link = Params::getParam("b_link") != '' ? 1 : 0;
             $s_internal_name = osc_sanitizeString($s_internal_name);
             $meta = Params::getParam('meta');
             $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('aFieldsDescription', $aFieldsDescription);
             if ($s_internal_name == '') {
                 osc_add_flash_error_message(_m('You have to set an internal name'), 'admin');
                 $this->redirectTo(osc_admin_base_url(true) . "?page=pages&action=add");
//.........这里部分代码省略.........
开发者ID:oanav,项目名称:closetshare,代码行数:101,代码来源:pages.php


示例14: doModel

 function doModel()
 {
     parent::doModel();
     //specific things for this class
     switch ($this->action) {
         case 'edit':
             if (Params::getParam("id") == '') {
                 $this->redirectTo(osc_admin_base_url(true) . "?page=pages");
             }
             $form = count(Session::newInstance()->_getForm());
             $keepForm = count(Session::newInstance()->_getKeepForm());
             if ($form == 0 || $form == $keepForm) {
                 Session::newInstance()->_dropKeepForm();
             }
             $this->_exportVariableToView("page", $this->pageManager->findByPrimaryKey(Params::getParam("id")));
             $this->doView("pages/frm.php");
             break;
         case 'edit_post':
             $id = Params::getParam("id");
             $s_internal_name = Params::getParam("s_internal_name");
             $s_internal_name = osc_sanitizeString($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('aFieldsDescription', $aFieldsDescription);
             if ($s_internal_name == '') {
                 osc_add_flash_error_message(_m('You have to set an internal name'), 'admin');
                 $this->redirectTo(osc_admin_base_url(true) . "?page=pages&action=edit&id=" . $id);
             }
             if (!WebThemes::newInstance()->isValidPage($s_internal_name)) {
                 osc_add_flash_error_message(_m('You have to set a different internal name'), 'admin');
                 $this->redirectTo(osc_admin_base_url(true) . "?page=pages&action=edit&id=" . $id);
             }
             Session::newInstance()->_setForm('s_internal_name', $s_internal_name);
             if ($not_empty) {
                 foreach ($aFieldsDescription as $k => $_data) {
                     $this->pageManager->updateDescription($id, $k, $_data['s_title'], $_data['s_text']);
                 }
                 if (!$this->pageManager->internalNameExists($id, $s_internal_name)) {
                     if (!$this->pageManager->isIndelible($id)) {
                         $this->pageManager->updateInternalName($id, $s_internal_name);
                     }
                     Session::newInstance()->_clearVariables();
                     osc_add_flash_ok_message(_m('The page has been updated'), 'admin');
                     $this->redirectTo(osc_admin_base_url(true) . "?page=pages");
                 }
                 osc_add_flash_error_message(_m("You can't repeat internal name"), 'admin');
             } else {
                 osc_add_flash_error_message(_m("The page couldn't be updated, at least one title should not be empty"), 'admin');
             }
             $this->redirectTo(osc_admin_base_url(true) . "?page=pages&action=edit&id=" . $id);
             break;
         case 'add':
             $form = count(Session::newInstance()->_getForm());
             $keepForm = count(Session::newInstance()->_getKeepForm());
             if ($form == 0 || $form == $keepForm) {
                 Session::newInstance()->_dropKeepForm();
             }
             $this->_exportVariableToView("page", array());
             $this->doView("pages/frm.php");
             break;
         case 'add_post':
             $s_internal_name = Params::getParam("s_internal_name");
             $s_internal_name = osc_sanitizeString($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('aFieldsDescription', $aFieldsDescription);
             if ($s_internal_name == '') {
                 osc_add_flash_error_message(_m('You have to set an internal name'), 'admin');
                 $this->redirectTo(osc_admin_base_url(true) . "?page=pages&action=add");
             }
             if (!WebThemes::newInstance()->isValidPage($s_internal_name)) {
                 osc_add_flash_error_message(_m('You have to set a different internal name'), 'admin');
                 $this->redirectTo(osc_admin_base_url(true) . "?page=pages&action=add");
             }
             $aFields = array('s_internal_name' => $s_internal_name, 'b_indelible' => '0');
             Session::newInstance()->_setForm('s_internal_name', $s_internal_name);
             $page = $this->pageManager->findByInternalName($s_internal_name);
             if (!isset($page['pk_i_id'])) {
                 if ($not_empty) {
                     $result = $this->pageManager->insert($aFields, $aFieldsDescription);
                     Session::newInstance()->_clearVariables();
                     osc_add_flash_ok_message(_m('The page has been added'), 'admin');
//.........这里部分代码省略.........
开发者ID:semul,项目名称:Osclass,代码行数:101,代码来源:pages.php


示例15: install

 public function install()
 {
     $this->import('payment/struct.sql');
     osc_set_preference('version', '200', 'payment', 'INTEGER');
     osc_set_preference('default_premium_cost', '1.0', 'payment', 'STRING');
     osc_set_preference('allow_premium', '0', 'payment', 'BOOLEAN');
     osc_set_preference('default_publish_cost', '1.0', 'payment', 'STRING');
     osc_set_preference('pay_per_post', '0', 'payment', 'BOOLEAN');
     osc_set_preference('premium_days', '7', 'payment', 'INTEGER');
     osc_set_preference('currency', 'USD', 'payment', 'STRING');
     osc_set_preference('pack_price_1', '', 'payment', 'STRING');
     osc_set_preference('pack_price_2', '', 'payment', 'STRING');
     osc_set_preference('pack_price_3', '', 'payment', 'STRING');
     osc_set_preference('paypal_api_username', payment_crypt(''), 'payment', 'STRING');
     osc_set_preference('paypal_api_password', payment_crypt(''), 'payment', 'STRING');
     osc_set_preference('paypal_api_signature', payment_crypt(''), 'payment', 'STRING');
     osc_set_preference('paypal_email', '', 'payment', 'STRING');
     osc_set_preference('paypal_standard', '1', 'payment', 'BOOLEAN');
     osc_set_preference('paypal_sandbox', '1', 'payment', 'BOOLEAN');
     osc_set_preference('paypal_enabled', '0', 'payment', 'BOOLEAN');
     osc_set_preference('blockchain_btc_address', '', 'payment', 'STRING');
     osc_set_preference('blockchain_enabled', '0', 'payment', 'BOOLEAN');
     osc_set_preference('braintree_merchant_id', payment_crypt(''), 'payment', 'STRING');
     osc_set_preference('braintree_public_key', payment_crypt(''), 'payment', 'STRING');
     osc_set_preference('braintree_private_key', payment_crypt(''), 'payment', 'STRING');
     osc_set_preference('braintree_encryption_key', payment_crypt(''), 'payment', 'STRING');
     osc_set_preference('braintree_sandbox', 'sandbox', 'payment', 'STRING');
     osc_set_preference('braintree_enabled', '0', 'payment', 'BOOLEAN');
     osc_set_preference('stripe_secret_key', payment_crypt(''), 'payment', 'STRING');
     osc_set_preference('stripe_public_key', payment_crypt(''), 'payment', 'STRING');
     osc_set_preference('stripe_secret_key_test', payment_crypt(''), 'payment', 'STRING');
     osc_set_preference('stripe_public_key_test', payment_crypt(''), 'payment', 'STRING');
     osc_set_preference('stripe_sandbox', 'sandbox', 'payment', 'STRING');
     osc_set_preference('stripe_enabled', '0', 'payment', 'BOOLEAN');
     osc_set_preference('coinjar_merchant_user', payment_crypt(''), 'payment', 'STRING');
     osc_set_preference('coinjar_merchant_password', payment_crypt(''), 'payment', 'STRING');
     osc_set_preference('coinjar_api_key', payment_crypt(''), 'payment', 'STRING');
     osc_set_preference('coinjar_sb_merchant_user', payment_crypt(''), 'payment', 'STRING');
     osc_set_preference('coinjar_sb_merchant_password', payment_crypt(''), 'payment', 'STRING');
     osc_set_preference('coinjar_sb_api_key', payment_crypt(''), 'payment', 'STRING');
     osc_set_preference('coinjar_merchant_reference', osc_sanitizeString(osc_page_title()), 'payment', 'STRING');
     osc_set_preference('coinjar_sandbox', 'sandbox', 'payment', 'STRING');
     osc_set_preference('coinjar_enabled', '0', 'payment', 'BOOLEAN');
     $this->dao->select('pk_i_id');
     $this->dao->from(DB_TABLE_PREFIX . 't_item');
     $result = $this->dao->get();
     if ($result) {
         $items = $result->result();
         $date = date("Y-m-d H:i:s");
         foreach ($items as $item) {
             $this->createItem($item['pk_i_id'], 1, $date);
         }
     }
     $description[osc_language()]['s_title'] = '{WEB_TITLE} - Publish option for your ad: {ITEM_TITLE}';
     $description[osc_language()]['s_text'] = '<p>Hi {CONTACT_NAME}!</p><p>We just published your item ({ITEM_TITLE}) on {WEB_TITLE}.</p><p>{START_PUBLISH_FEE}</p><p>In order to make your ad available to anyone on {WEB_TITLE}, you should complete the process and pay the publish fee. You could do that on the following link: {PUBLISH_LINK}</p><p>{END_PUBLISH_FEE}</p><p>{START_PREMIUM_FEE}</p><p>You could make your ad premium and make it to appear on top result of the searches made on {WEB_TITLE}. You could do that on the following link: {PREMIUM_LINK}</p><p>{END_PREMIUM_FEE}</p><p>This is an automatic email, if you already did that, please ignore this email.</p><p>Thanks</p>';
     $res = Page::newInstance()->insert(array('s_internal_name' => 'email_payment', 'b_indelible' => '1'), $description);
 }
开发者ID:virsoni,项目名称:plugin-payment,代码行数:57,代码来源:ModelPayment.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP osc_sanitize_string函数代码示例发布时间:2022-05-15
下一篇:
PHP osc_run_hook函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap