本文整理汇总了PHP中osc_search_category_url函数的典型用法代码示例。如果您正苦于以下问题:PHP osc_search_category_url函数的具体用法?PHP osc_search_category_url怎么用?PHP osc_search_category_url使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了osc_search_category_url函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: drawSubcategory
function drawSubcategory($category)
{
if (osc_count_subcategories2() > 0) {
osc_category_move_to_children();
?>
<ul>
<?php
while (osc_has_categories()) {
?>
<li><a class="category cat_<?php
echo osc_category_id();
?>
" href="<?php
echo osc_search_category_url();
?>
"><?php
echo osc_category_name();
?>
</a> <span>(<?php
echo osc_category_total_items();
?>
)</span><?php
drawSubcategory(osc_category());
?>
</li>
<?php
}
?>
</ul>
<?php
osc_category_move_to_parent();
}
}
示例2: Subcategory
function Subcategory($category)
{
if (osc_count_subcategories2() > 0) {
osc_category_move_to_children();
?>
<div id="cat_<?php
echo $category['pk_i_id'];
?>
" class="panel-collapse collapse">
<div class="panel-body">
<ul>
<?php
while (osc_has_categories()) {
?>
<?php
if (osc_category_total_items() < 1 && nc_osc_hide_categories()) {
continue;
}
?>
<li>
<a data-parent="#cat_<?php
echo $category['pk_i_id'];
?>
" href="<?php
echo osc_search_category_url();
?>
">
<?php
echo osc_category_name();
?>
</a>
<span>(<?php
echo osc_category_total_items();
?>
)</span><?php
Subcategory(osc_category());
?>
</li>
<?php
}
?>
</ul>
</div>
</div>
<?php
osc_category_move_to_parent();
}
}
示例3: osc_item_category_url
function osc_item_category_url($category_id)
{
View::newInstance()->_erase('subcategories');
View::newInstance()->_erase('categories');
View::newInstance()->_exportVariableToView('category', Category::newInstance()->findByPrimaryKey($category_id));
$url = osc_search_category_url();
View::newInstance()->_erase('category');
return $url;
}
示例4: ajaxPayment
public static function ajaxPayment()
{
$status = self::processPayment();
$data = payment_get_custom(Params::getParam('extra'));
$product_type = explode('x', $data['product']);
if ($status == PAYMENT_COMPLETED) {
osc_add_flash_ok_message(sprintf(__('Success! Please write down this transaction ID in case you have any problem: %s', 'payment'), Params::getParam('stripe_transaction_id')));
if ($product_type[0] == 101) {
$item = Item::newInstance()->findByPrimaryKey($product_type[2]);
$category = Category::newInstance()->findByPrimaryKey($item['fk_i_category_id']);
View::newInstance()->_exportVariableToView('category', $category);
payment_js_redirect_to(osc_search_category_url());
} else {
if ($product_type[0] == 201) {
if (osc_is_web_user_logged_in()) {
payment_js_redirect_to(osc_route_url('payment-user-menu'));
} else {
View::newInstance()->_exportVariableToView('item', Item::newInstance()->findByPrimaryKey($product_type[2]));
payment_js_redirect_to(osc_item_url());
}
} else {
if (osc_is_web_user_logged_in()) {
payment_js_redirect_to(osc_route_url('payment-user-pack'));
} else {
// THIS SHOULD NOT HAPPEN
payment_js_redirect_to(osc_base_path());
}
}
}
} else {
if ($status == PAYMENT_ALREADY_PAID) {
osc_add_flash_warning_message(__('Warning! This payment was already paid', 'payment'));
} else {
osc_add_flash_error_message(_e('There were an error processing your payment', 'payment'));
}
if ($product_type[0] == 301) {
if (osc_is_web_user_logged_in()) {
payment_js_redirect_to(osc_route_url('payment-user-pack'));
} else {
// THIS SHOULD NOT HAPPEN
payment_js_redirect_to(osc_base_path());
}
} else {
if (osc_is_web_user_logged_in()) {
payment_js_redirect_to(osc_route_url('payment-user-menu'));
} else {
View::newInstance()->_exportVariableToView('item', Item::newInstance()->findByPrimaryKey($product_type[2]));
payment_js_redirect_to(osc_item_url());
}
}
}
}
示例5: pop_draw_categories_list
function pop_draw_categories_list()
{
?>
<?php
if (!osc_is_home_page()) {
echo '<div class="resp-wrapper">';
}
?>
<?php
//cell_3
$total_categories = osc_count_categories();
$col1_max_cat = ceil($total_categories / 3);
osc_goto_first_category();
$i = 0;
while (osc_has_categories()) {
?>
<?php
if ($i % $col1_max_cat == 0) {
if ($i > 0) {
echo '</div>';
}
if ($i == 0) {
echo '<div class="cell_3 first_cel">';
} else {
echo '<div class="cell_3">';
}
}
?>
<ul class="r-list">
<li>
<h1>
<?php
$_slug = osc_category_slug();
$_url = osc_search_category_url();
$_name = osc_category_name();
$_total_items = osc_category_total_items();
if (osc_count_subcategories() > 0) {
?>
<span class="collapse resp-toogle"><i class="fa fa-caret-right fa-lg"></i></span>
<?php
}
?>
<?php
if ($_total_items > 0) {
?>
<a class="category <?php
echo $_slug;
?>
" href="<?php
echo $_url;
?>
"><?php
echo $_name;
?>
</a> <span>(<?php
echo $_total_items;
?>
)</span>
<?php
} else {
?>
<a class="category <?php
echo $_slug;
?>
" href="#"><?php
echo $_name;
?>
</a> <span>(<?php
echo $_total_items;
?>
)</span>
<?php
}
?>
</h1>
<?php
if (osc_count_subcategories() > 0) {
?>
<ul>
<?php
while (osc_has_subcategories()) {
?>
<li>
<?php
if (osc_category_total_items() > 0) {
?>
<a class="category sub-category <?php
echo osc_category_slug();
?>
" href="<?php
echo osc_search_category_url();
?>
"><?php
echo osc_category_name();
?>
</a> <span>(<?php
echo osc_category_total_items();
?>
)</span>
<?php
//.........这里部分代码省略.........
示例6: get_parent_subcategories
function get_parent_subcategories($category_id)
{
$subcategory = array();
View::newInstance()->_exportVariableToView('category', osc_get_category('id', $category_id));
osc_goto_first_category();
while (osc_has_subcategories()) {
$sc = array('name' => osc_category_name(), 'url' => osc_search_category_url());
array_push($subcategory, $sc);
}
return $subcategory;
}
示例7: doModel
function doModel()
{
//calling the view...
$locales = OSCLocale::newInstance()->listAllEnabled();
$this->_exportVariableToView('locales', $locales);
switch ($this->action) {
case 'item_add':
// post
if (osc_reg_user_post() && $this->user == null) {
// CHANGEME: This text
osc_add_flash_error_message(_m('Only registered users are allowed to post items'));
$this->redirectTo(osc_user_login_url());
}
$countries = Country::newInstance()->listAll();
$regions = array();
if (isset($this->user['fk_c_country_code']) && $this->user['fk_c_country_code'] != '') {
$regions = Region::newInstance()->getByCountry($this->user['fk_c_country_code']);
} else {
if (count($countries) > 0) {
$regions = Region::newInstance()->getByCountry($countries[0]['pk_c_code']);
}
}
$cities = array();
if (isset($this->user['fk_i_region_id']) && $this->user['fk_i_region_id'] != '') {
$cities = City::newInstance()->listWhere("fk_i_region_id = %d", $this->user['fk_i_region_id']);
} else {
if (count($regions) > 0) {
$cities = City::newInstance()->listWhere("fk_i_region_id = %d", $regions[0]['pk_i_id']);
}
}
$this->_exportVariableToView('countries', $countries);
$this->_exportVariableToView('regions', $regions);
$this->_exportVariableToView('cities', $cities);
$form = count(Session::newInstance()->_getForm());
$keepForm = count(Session::newInstance()->_getKeepForm());
if ($form == 0 || $form == $keepForm) {
Session::newInstance()->_dropKeepForm();
}
if (Session::newInstance()->_getForm('countryId') != "") {
$countryId = Session::newInstance()->_getForm('countryId');
$regions = Region::newInstance()->getByCountry($countryId);
$this->_exportVariableToView('regions', $regions);
if (Session::newInstance()->_getForm('regionId') != "") {
$regionId = Session::newInstance()->_getForm('regionId');
$cities = City::newInstance()->listWhere("fk_i_region_id = %d", $regionId);
$this->_exportVariableToView('cities', $cities);
}
}
$this->_exportVariableToView('user', $this->user);
osc_run_hook('post_item');
$this->doView('item-post.php');
break;
case 'item_add_post':
//post_item
if (osc_reg_user_post() && $this->user == null) {
osc_add_flash_error_message(_m('Only registered users are allowed to post items'));
$this->redirectTo(osc_base_url(true));
}
$mItems = new ItemActions(false);
// prepare data for ADD ITEM
$mItems->prepareData(true);
// set all parameters into session
foreach ($mItems->data as $key => $value) {
Session::newInstance()->_setForm($key, $value);
}
$meta = Params::getParam('meta');
if (is_array($meta)) {
foreach ($meta as $key => $value) {
Session::newInstance()->_setForm('meta_' . $key, $value);
Session::newInstance()->_keepForm('meta_' . $key);
}
}
if (osc_recaptcha_private_key() != '' && Params::existParam("recaptcha_challenge_field")) {
if (!osc_check_recaptcha()) {
osc_add_flash_error_message(_m('The Recaptcha code is wrong'));
$this->redirectTo(osc_item_post_url());
return false;
// BREAK THE PROCESS, THE RECAPTCHA IS WRONG
}
}
// POST ITEM ( ADD ITEM )
$success = $mItems->add();
if ($success != 1 && $success != 2) {
osc_add_flash_error_message($success);
$this->redirectTo(osc_item_post_url());
} else {
Session::newInstance()->_dropkeepForm('meta_' . $key);
if ($success == 1) {
osc_add_flash_ok_message(_m('Check your inbox to verify your email address'));
} else {
osc_add_flash_ok_message(_m('Your item has been published'));
}
$itemId = Params::getParam('itemId');
$item = $this->itemManager->findByPrimaryKey($itemId);
osc_run_hook('posted_item', $item);
$category = Category::newInstance()->findByPrimaryKey(Params::getParam('catId'));
View::newInstance()->_exportVariableToView('category', $category);
$this->redirectTo(osc_search_category_url());
}
break;
//.........这里部分代码省略.........
示例8: osclasswizards_draw_categories_list
function osclasswizards_draw_categories_list()
{
if (!osc_is_home_page()) {
echo '<div class="resp-wrapper">';
}
?>
<h1 class="title"><?php
_e('Categories', OSCLASSWIZARDS_THEME_FOLDER);
?>
</h1>
<div class="row">
<?php
$total_categories = osc_count_categories();
$col1_max_cat = ceil($total_categories / 1);
osc_goto_first_category();
$catcount = 0;
while (osc_has_categories()) {
?>
<ul class="col-sm-6 col-md-3 grid_list">
<li>
<section class="listings">
<h2><i class="fa fa-<?php
echo osclasswizards_category_icon(osc_category_id());
?>
"></i>
<?php
$_slug = osc_category_slug();
$_url = osc_search_category_url();
$_name = osc_category_name();
$_total_items = osc_category_total_items();
if (osc_count_subcategories() > 0) {
?>
<?php
}
?>
<?php
if ($_total_items > 0) {
?>
<a class="category <?php
echo $_slug;
?>
" href="<?php
echo $_url;
?>
"><?php
echo $_name;
?>
</a> <span><?php
echo $_total_items;
?>
</span>
<?php
} else {
?>
<a class="category <?php
echo $_slug;
?>
" href="#"><?php
echo $_name;
?>
</a> <span><?php
echo $_total_items;
?>
</span>
<?php
}
?>
</h2>
<?php
if (osc_count_subcategories() > 0) {
$m = 1;
?>
<ul>
<?php
while (osc_has_subcategories()) {
if ($m <= osc_get_preference('sub_cat_limit', 'osclasswizards_theme')) {
?>
<li>
<?php
if (osc_category_total_items() > 0) {
?>
<a class="category sub-category <?php
echo osc_category_slug();
?>
" href="<?php
echo osc_search_category_url();
?>
"><?php
echo osc_category_name();
?>
</a> <span>(<?php
echo osc_category_total_items();
?>
)</span>
<?php
} else {
?>
<a class="category sub-category <?php
echo osc_category_slug();
//.........这里部分代码省略.........
示例9: doModel
function doModel()
{
//calling the view...
$locales = OSCLocale::newInstance()->listAllEnabled();
$this->_exportVariableToView('locales', $locales);
switch ($this->action) {
case 'item_add':
// post
if (!osc_users_enabled()) {
osc_add_flash_message(_m('Users not enabled'));
$this->redirectTo(osc_base_url(true));
}
if (osc_reg_user_post() && $this->user == null) {
// CHANGEME: This text
osc_add_flash_message(_m('Only registered users are allowed to post items'));
$this->redirectTo(osc_user_login_url());
}
$countries = Country::newInstance()->listAll();
$regions = array();
if (isset($this->user['fk_c_country_code']) && $this->user['fk_c_country_code'] != '') {
$regions = Region::newInstance()->getByCountry($this->user['fk_c_country_code']);
} else {
if (count($countries) > 0) {
$regions = Region::newInstance()->getByCountry($countries[0]['pk_c_code']);
}
}
$cities = array();
if (isset($this->user['fk_i_region_id']) && $this->user['fk_i_region_id'] != '') {
$cities = City::newInstance()->listWhere("fk_i_region_id = %d", $this->user['fk_i_region_id']);
} else {
if (count($regions) > 0) {
$cities = City::newInstance()->listWhere("fk_i_region_id = %d", $regions[0]['pk_i_id']);
}
}
$this->_exportVariableToView('countries', $countries);
$this->_exportVariableToView('regions', $regions);
$this->_exportVariableToView('cities', $cities);
$this->_exportVariableToView('user', $this->user);
osc_run_hook('post_item');
$this->doView('item-post.php');
break;
case 'item_add_post':
//post_item
if (!osc_users_enabled()) {
osc_add_flash_message(_m('Users not allowed'));
$this->redirectTo(osc_base_url(true));
}
if (osc_reg_user_post() && $this->user == null) {
osc_add_flash_message(_m('Only registered users are allowed to post items'));
$this->redirectTo(osc_base_url(true));
}
// POST ITEM ( ADD ITEM )
$mItems = new ItemActions(false);
$success = $mItems->add();
if ($success) {
$PcontactName = Params::getParam('contactName');
$PcontactEmail = Params::getParam('contactEmail');
$itemId = Params::getParam('itemId');
$item = array();
if (Session::newInstance()->_get('userId') == '') {
$mPages = new Page();
$aPage = $mPages->findByInternalName('email_new_item_non_register_user');
$locale = osc_current_user_locale();
$content = array();
if (isset($aPage['locale'][$locale]['s_title'])) {
$content = $aPage['locale'][$locale];
} else {
$content = current($aPage['locale']);
}
$item = $this->itemManager->findByPrimaryKey($itemId);
$item_url = osc_item_url();
// before page = user , action = item_edit
$edit_url = osc_item_edit_url($item['s_secret'], $itemId);
// before page = user , action = item_delete
$delete_url = osc_item_delete_url($item['s_secret'], $itemId);
$words = array();
$words[] = array('{ITEM_ID}', '{USER_NAME}', '{USER_EMAIL}', '{WEB_URL}', '{ITEM_TITLE}', '{ITEM_URL}', '{WEB_TITLE}', '{EDIT_LINK}', '{EDIT_URL}', '{DELETE_LINK}', '{DELETE_URL}');
$words[] = array($itemId, $PcontactName, $PcontactEmail, osc_base_url(), $item['s_title'], $item_url, osc_page_title(), '<a href="' . $edit_url . '">' . $edit_url . '</a>', $edit_url, '<a href="' . $delete_url . '">' . $delete_url . '</a>', $delete_url);
$title = osc_mailBeauty($content['s_title'], $words);
$body = osc_mailBeauty($content['s_text'], $words);
$emailParams = array('subject' => $title, 'to' => $PcontactEmail, 'to_name' => $PcontactName, 'body' => $body, 'alt_body' => $body);
osc_sendMail($emailParams);
}
osc_run_hook('posted_item', $item);
$category = Category::newInstance()->findByPrimaryKey(Params::getParam('catId'));
View::newInstance()->_exportVariableToView('category', $category);
$this->redirectTo(osc_search_category_url());
} else {
$this->redirectTo(osc_item_post_url());
}
break;
case 'item_edit':
$secret = Params::getParam('secret');
$id = Params::getParam('id');
$item = $this->itemManager->listWhere("i.pk_i_id = '%s' AND ((i.s_secret = '%s' AND i.fk_i_user_id IS NULL) OR (i.fk_i_user_id = '%d'))", $id, $secret, $this->userId);
if (count($item) == 1) {
$item = Item::newInstance()->findByPrimaryKey($id);
$categories = Category::newInstance()->toTree();
$countries = Country::newInstance()->listAll();
$regions = array();
//.........这里部分代码省略.........
示例10: payment_get_custom
<?php
$data = payment_get_custom(Params::getParam('extra'));
$url = osc_base_url();
if (isset($data['product']) && isset($data['itemid'])) {
$product = explode('x', $data['product']);
if ($product[0] == '301') {
// PACK PAYMENT FROM USER'S DASHBOARD
$url = osc_user_dashboard_url();
} else {
$item = Item::newInstance()->findByPrimaryKey($data['itemid']);
$category = Category::newInstance()->findByPrimaryKey($item['fk_i_category_id']);
View::newInstance()->_exportVariableToView('category', $category);
$url = osc_search_category_url();
}
} else {
}
osc_add_flash_error_message(__('You cancel the payment process or there was an error. If the error continue, please contact the administrator', 'payment'));
_e('You cancel the payment process or there was an error. If the error continue, please contact the administrator', 'payment');
payment_js_redirect_to($url);
示例11: item_success_redirect
function item_success_redirect($item)
{
if (!OC_ADMIN) {
if (isset($item['pk_i_id'])) {
Session::newInstance()->_dropKeepForm();
if ($item['b_active'] == 0) {
osc_add_flash_ok_message(_m('Check your inbox to validate your listing'));
} else {
// only if enabled and active can show item-success page
if ($item['b_active'] == 1 && $item['b_enabled'] == 1) {
// item-success redirect
Session::newInstance()->_set('inserted_item', $item);
osc_redirect_to(osc_route_url('item-success'));
exit;
}
}
$itemId = Params::getParam('itemId');
$category = Category::newInstance()->findByPrimaryKey(Params::getParam('catId'));
View::newInstance()->_exportVariableToView('category', $category);
osc_redirect_to(osc_search_category_url());
}
}
}
示例12: get_parent_subcategories
function get_parent_subcategories($iCategoryId)
{
$aSubCategory = array();
osc_goto_first_category();
while (osc_has_categories()) {
if (osc_category_id() == $iCategoryId) {
if (osc_count_subcategories() > 0) {
while (osc_has_subcategories()) {
$aSubCat = array('name' => osc_category_name(), 'url' => osc_search_category_url());
array_push($aSubCategory, $aSubCat);
}
}
}
}
return $aSubCategory;
}
示例13: init
public function init()
{
if (in_array($this->getLocation(), array('item', 'page', 'search', 'login', 'register', 'user', 'contact'))) {
$l = array('url' => osc_base_url(), 'title' => osc_page_title());
$this->addLevel($l);
}
switch ($this->getLocation()) {
case 'item':
if ($this->getSection() == 'item_add') {
$l = array('title' => $this->title['item_add']);
$this->addLevel($l);
break;
}
$aCategory = osc_get_category('id', osc_item_category_id());
// remove
View::newInstance()->_erase('categories');
View::newInstance()->_erase('subcategories');
View::newInstance()->_exportVariableToView('category', $aCategory);
$l = array('url' => osc_search_category_url(), 'title' => osc_category_name());
$this->addLevel($l);
switch ($this->getSection()) {
case 'item_edit':
$l = array('url' => osc_item_url(), 'title' => osc_item_title());
$this->addLevel($l);
$l = array('title' => $this->title['item_edit']);
$this->addLevel($l);
break;
case 'send_friend':
$l = array('url' => osc_item_url(), 'title' => osc_item_title());
$this->addLevel($l);
$l = array('title' => $this->title['item_send_friend']);
$this->addLevel($l);
break;
case 'contact':
$l = array('url' => osc_item_url(), 'title' => osc_item_title());
$this->addLevel($l);
$l = array('title' => $this->title['item_contact']);
$this->addLevel($l);
break;
case '':
$l = array('title' => osc_item_title());
$this->addLevel($l);
break;
}
break;
case 'search':
$region = osc_search_region();
$city = osc_search_city();
$pattern = osc_search_pattern();
$category = osc_search_category_id();
$category = count($category) == 1 ? $category[0] : '';
$b_show_all = $pattern == '' && $category == '' && $region == '' && $city == '';
$b_category = $category != '';
$b_pattern = $pattern != '';
$b_region = $region != '';
$b_city = $city != '';
$b_location = $b_region || $b_city;
// show all
if ($b_show_all) {
$l = array('title' => $this->title['search']);
$this->addLevel($l);
break;
}
// category
if ($b_category) {
$aCategories = Category::newInstance()->toRootTree($category);
foreach ($aCategories as $c) {
View::newInstance()->_erase('categories');
View::newInstance()->_erase('subcategories');
View::newInstance()->_exportVariableToView('category', $c);
$l = array('url' => osc_search_category_url(), 'title' => osc_category_name());
$this->addLevel($l);
}
}
// location
if ($b_location) {
$params = array();
if ($b_category) {
$params['sCategory'] = $category;
}
if ($b_city) {
//print_r("~~~~~~~~~~~~~~~~~~~".$city."~~~~~~~~~~~~~~~~~~~~");
$aCity = City::newInstance()->findByName($city);
if (count($aCity) == 0) {
$params['sCity'] = $city;
$l = array('url' => osc_search_url($params), 'title' => $city);
$this->addLevel($l);
} else {
$aRegion = Region::newInstance()->findByPrimaryKey($aCity['fk_i_region_id']);
$params['sRegion'] = $aRegion['s_name'];
$l = array('url' => osc_search_url($params), 'title' => $aRegion['s_name']);
$this->addLevel($l);
$params['sCity'] = $aCity['s_name'];
$l = array('url' => osc_search_url($params), 'title' => $aCity['s_name']);
$this->addLevel($l);
}
} else {
if ($b_region) {
$params['sRegion'] = $region;
$l = array('url' => osc_search_url($params), 'title' => $region);
//.........这里部分代码省略.........
示例14: osclasswizards_draw_categories_list
function osclasswizards_draw_categories_list()
{
if (!osc_is_home_page()) {
echo '<div class="resp-wrapper">';
}
?>
<h1 class="title">
<?php
_e("Categories", 'osclasswizards');
?>
</h1>
<?php
//cell_3
$total_categories = osc_count_categories();
$col1_max_cat = ceil($total_categories / 1);
osc_goto_first_category();
$i = 0;
$catcount = 0;
while (osc_has_categories()) {
$catcount++;
if ($catcount == 1) {
echo '<div class="row">';
}
?>
<ul class="col-sm-6 col-md-6 grid_list">
<li>
<?php
$_slug = osc_category_slug();
$_url = osc_search_category_url();
$_name = osc_category_name();
$_total_items = osc_category_total_items();
if (osc_count_subcategories() > 0) {
?>
<section class="listings row">
<h2 class="col-md-7 category <?php
echo $_slug;
?>
<?php
echo $_name;
?>
">
<?php
if ($_total_items > 0) {
?>
<a href="<?php
echo $_url;
?>
"><?php
echo $_name;
?>
</a> <span><?php
echo $_total_items;
?>
</span>
<?php
} else {
?>
<a href="#"><?php
echo $_name;
?>
</a> <span><?php
echo $_total_items;
?>
</span>
<?php
}
?>
<?php
}
?>
</h2>
<?php
if (osc_count_subcategories() > 0) {
$m = 1;
?>
<ul class="col-md-5">
<?php
while (osc_has_subcategories()) {
if ($m <= 5) {
?>
<li>
<?php
if (osc_category_total_items() > 0) {
?>
<a class="category sub-category <?php
echo osc_category_slug();
?>
" href="<?php
echo osc_search_category_url();
?>
"><?php
echo osc_category_name();
?>
</a> <span>(<?php
echo osc_category_total_items();
?>
)</span>
//.........这里部分代码省略.........
示例15: doModel
//.........这里部分代码省略.........
$this->redirectTo(osc_item_post_url());
return false;
// BREAK THE PROCESS, THE RECAPTCHA IS WRONG
}
}
if (!osc_is_web_user_logged_in()) {
$user = User::newInstance()->findByEmail($mItems->data['contactEmail']);
// The user exists but it's not logged
if (isset($user['pk_i_id'])) {
foreach ($mItems->data as $key => $value) {
Session::newInstance()->_keepForm($key);
}
osc_add_flash_error_message(_m('A user with that email address already exists, if it is you, please log in'));
$this->redirectTo(osc_user_login_url());
}
}
// POST ITEM ( ADD ITEM )
$success = $mItems->add();
if ($success != 1 && $success != 2) {
osc_add_flash_error_message($success);
$this->redirectTo(osc_item_post_url());
} else {
Session::newInstance()->_dropkeepForm('meta_' . $key);
if ($success == 1) {
osc_add_flash_ok_message(_m('Check your inbox to validate your listing'));
} else {
osc_add_flash_ok_message(_m('Your listing has been published'));
}
$itemId = Params::getParam('itemId');
$item = $this->itemManager->findByPrimaryKey($itemId);
osc_run_hook('posted_item', $item);
$category = Category::newInstance()->findByPrimaryKey(Params::getParam('catId'));
View::newInstance()->_exportVariableToView('category', $category);
$this->redirectTo(osc_search_category_url());
}
break;
case 'item_edit':
// edit item
$secret = Params::getParam('secret');
$id = Params::getParam('id');
$item = $this->itemManager->listWhere("i.pk_i_id = '%s' AND ((i.s_secret = '%s' AND i.fk_i_user_id IS NULL) OR (i.fk_i_user_id = '%d'))", addslashes($id), addslashes($secret), addslashes($this->userId));
if (count($item) == 1) {
$item = Item::newInstance()->findByPrimaryKey($id);
$form = count(Session::newInstance()->_getForm());
$keepForm = count(Session::newInstance()->_getKeepForm());
if ($form == 0 || $form == $keepForm) {
Session::newInstance()->_dropKeepForm();
}
$this->_exportVariableToView('item', $item);
osc_run_hook("before_item_edit", $item);
$this->doView('item-edit.php');
} else {
// add a flash message [ITEM NO EXISTE]
osc_add_flash_error_message(_m("Sorry, we don't have any listings with that ID"));
if ($this->user != null) {
$this->redirectTo(osc_user_list_items_url());
} else {
$this->redirectTo(osc_base_url());
}
}
break;
case 'item_edit_post':
// recoger el secret y el
$secret = Params::getParam('secret');
$id = Params::getParam('id');
$item = $this->itemManager->listWhere("i.pk_i_id = '%s' AND ((i.s_secret = '%s' AND i.fk_i_user_id IS NULL) OR (i.fk_i_user_id = '%d'))", addslashes($id), addslashes($secret), addslashes($this->userId));