本文整理汇总了PHP中osc_language函数的典型用法代码示例。如果您正苦于以下问题:PHP osc_language函数的具体用法?PHP osc_language怎么用?PHP osc_language使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了osc_language函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doModel
function doModel()
{
parent::doModel();
//specific things for this class
switch ($this->action) {
case 'add_post_default':
// add default category and reorder parent categories
$fields['fk_i_parent_id'] = NULL;
$fields['i_expiration_days'] = 0;
$fields['i_position'] = 0;
$fields['b_enabled'] = 1;
$default_locale = osc_language();
$aFieldsDescription[$default_locale]['s_name'] = "NEW CATEGORY, EDIT ME!";
$categoryId = $this->categoryManager->insert($fields, $aFieldsDescription);
// reorder parent categories. NEW category first
$rootCategories = $this->categoryManager->findRootCategories();
foreach ($rootCategories as $cat) {
$order = $cat['i_position'];
$order++;
$this->categoryManager->updateOrder($cat['pk_i_id'], $order);
}
$this->categoryManager->updateOrder($categoryId, '0');
$this->redirectTo(osc_admin_base_url(true) . '?page=categories');
break;
default:
//
$this->_exportVariableToView("categories", $this->categoryManager->toTreeAll());
$this->doView("categories/index.php");
}
}
示例2: install
/**
* Install plugin moreedit
*/
public function install()
{
$array = array('s_internal_name' => 'email_moreedit_notify_edit', 'b_indelible' => 1, 'dt_pub_date' => date('Y-m-d H:i:s'));
$this->dao->insert(DB_TABLE_PREFIX . 't_pages', $array);
$id = $this->dao->insertedId();
$array_description = array('fk_i_pages_id' => $id, 'fk_c_locale_code' => osc_language(), 's_title' => '{WEB_TITLE} - Notification of ad: {ITEM_TITLE}', 's_text' => '<p>Hi Admin!</p>\\r\\n<p> </p>\\r\\n<p>We just published an item ({ITEM_TITLE}) on {WEB_TITLE} from user {USER_NAME} ( {ITEM_URL} ).</p>\\r\\n<p>Edit it here : {EDIT_LINK}</p>\\r\\n<p> </p>\\r\\n<p>Thanks</p>');
$this->dao->insert(DB_TABLE_PREFIX . 't_pages_description', $array_description);
}
示例3: doModel
function doModel()
{
parent::doModel();
//specific things for this class
switch ($this->action) {
case 'add_post_default':
// add default category and reorder parent categories
$fields['fk_i_parent_id'] = NULL;
$fields['i_expiration_days'] = 0;
$fields['i_position'] = 0;
$fields['b_enabled'] = 1;
$default_locale = osc_language();
$aFieldsDescription[$default_locale]['s_name'] = "NEW CATEGORY, EDIT ME!";
$categoryId = $this->categoryManager->insert($fields, $aFieldsDescription);
// reorder parent categories. NEW category first
$rootCategories = $this->categoryManager->findRootCategories();
foreach ($rootCategories as $cat) {
$order = $cat['i_position'];
$order++;
$this->categoryManager->updateOrder($cat['pk_i_id'], $order);
}
$this->categoryManager->updateOrder($categoryId, '0');
$this->redirectTo(osc_admin_base_url(true) . '?page=categories');
break;
case 'settings':
// calling the categories settings view
$this->doView('categories/settings.php');
break;
case 'settings_post':
// updating categories option
$selectableParent = Params::getParam('selectable_parent_categories');
$updated = Preference::newInstance()->update(array('s_value' => $selectableParent), array('s_name' => 'selectable_parent_categories'));
if ($updated > 0) {
osc_add_flash_ok_message(_m("Categories' settings have been updated"), 'admin');
}
$this->redirectTo(osc_admin_base_url(true) . '?page=categories&action=settings');
break;
default:
//
$this->_exportVariableToView("categories", $this->categoryManager->toTreeAll());
$this->doView("categories/index.php");
}
}
示例4: adManage_install
function adManage_install()
{
$conn = getConnection();
$path = osc_plugin_resource('advanced_ad_management/struct.sql');
$sql = file_get_contents($path);
$conn->osc_dbImportSQL($sql);
osc_set_preference('adManageed_expire', '4', 'plugin-item_adManage', 'INTEGER');
osc_set_preference('adManageed_payperpost', '1', 'plugin-item_adManage', 'INTEGER');
osc_set_preference('adManageed_repubTimes', '5', 'plugin-item_adManage', 'INTEGER');
osc_set_preference('adManageed_installed', '0', 'plugin-item_adManage', 'INTEGER');
osc_set_preference('adManageed_freeRepubs', '0', 'plugin-item_adManage', 'INTEGER');
osc_set_preference('adManageed_expireEmail', '1', 'plugin-item_adManage', 'INTEGER');
osc_set_preference('adManageed_deleteDays', '0', 'plugin-item_adManage', 'INTEGER');
//used for email template
$conn->osc_dbExec("INSERT IGNORE INTO %st_pages (s_internal_name, b_indelible, dt_pub_date) VALUES ('email_ad_expire', 1, NOW() )", DB_TABLE_PREFIX);
$conn->osc_dbExec("INSERT IGNORE INTO %st_pages_description (fk_i_pages_id, fk_c_locale_code, s_title, s_text) VALUES (%d, '%s', '{WEB_TITLE} - Your ad {ITEM_TITLE} is about to expire.', '<p>Hi {CONTACT_NAME}!</p>\r\n<p> </p>\r\n<p>Your ad is about to expire, click on the link if you would like to extend your ad {REPUBLISH_URL}</p><p> </p>\r\n<p>This is an automatic email, Please do not respond to this email.</p>\r\n<p> </p>\r\n<p>Thanks</p>\r\n<p>{WEB_TITLE}</p>')", DB_TABLE_PREFIX, $conn->get_last_id(), osc_language());
$conn->osc_dbExec("INSERT IGNORE INTO %st_pages (s_internal_name, b_indelible, dt_pub_date) VALUES ('email_ad_expired', 1, NOW() )", DB_TABLE_PREFIX);
$conn->osc_dbExec("INSERT IGNORE INTO %st_pages_description (fk_i_pages_id, fk_c_locale_code, s_title, s_text) VALUES (%d, '%s', '{WEB_TITLE} - Your ad {ITEM_TITLE} has expired.', '<p>Hi {CONTACT_NAME}!</p>\r\n<p> </p>\r\n<p>Your ad has expired. You may renew your ad by clicking on the link {REPUBLISH_URL}. Otherwise your ad will be permanently deleted in {PERM_DELETED} days</p><p> </p>\r\n<p>This is an automatic email, Please do not respond to this email.</p>\r\n<p> </p>\r\n<p>Thanks</p>\r\n<p>{WEB_TITLE}</p>')", DB_TABLE_PREFIX, $conn->get_last_id(), osc_language());
}
示例5: __get
*
* This program is free software: you can redistribute it and/or modify it under the terms
* of the GNU Affero General Public License as published by the Free Software Foundation,
* either version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
$locales = __get('locales');
$last = end($locales);
$last_id = $last['pk_c_code'];
$default_lang = osc_language();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US">
<head>
<?php
osc_current_admin_theme_path('head.php');
?>
</head>
<body>
<?php
osc_current_admin_theme_path('header.php');
?>
<div id="update_version" style="display:none;"></div>
<script type="text/javascript">
$(function() {
示例6: doModel
//.........这里部分代码省略.........
case 'users':
// calling the users settings view
$this->doView('settings/users.php');
break;
case 'users_post':
// updating users
$iUpdated = 0;
$enabledUserValidation = Params::getParam('enabled_user_validation');
$enabledUserValidation = $enabledUserValidation != '' ? true : false;
$enabledUserRegistration = Params::getParam('enabled_user_registration');
$enabledUserRegistration = $enabledUserRegistration != '' ? true : false;
$enabledUsers = Params::getParam('enabled_users');
$enabledUsers = $enabledUsers != '' ? true : false;
$iUpdated += Preference::newInstance()->update(array('s_value' => $enabledUserValidation), array('s_name' => 'enabled_user_validation'));
$iUpdated += Preference::newInstance()->update(array('s_value' => $enabledUserRegistration), array('s_name' => 'enabled_user_registration'));
$iUpdated += Preference::newInstance()->update(array('s_value' => $enabledUsers), array('s_name' => 'enabled_users'));
if ($iUpdated > 0) {
osc_add_flash_message(_m('Users\' settings have been updated'), 'admin');
}
$this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=users');
break;
case 'locations':
// calling the locations settings view
$location_action = Params::getParam('type');
$mCountries = new Country();
switch ($location_action) {
case 'add_country':
// add country
if (!Params::getParam('c_manual')) {
$this->install_location_by_country();
} else {
$countryCode = Params::getParam('c_country');
$countryName = Params::getParam('country');
$countryLanguage = osc_language();
$exists = $mCountries->findByCode($countryCode);
if (!isset($exists['s_name'])) {
$data = array('pk_c_code' => $countryCode, 'fk_c_locale_code' => $countryLanguage, 's_name' => $countryName);
$mCountries->insert($data);
osc_add_flash_message(sprintf(__('%s has been added as a new country'), $countryName), 'admin');
} else {
osc_add_flash_message(sprintf(__('%s already was in the database'), $countryName), 'admin');
}
}
$this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=locations');
break;
case 'edit_country':
// edit country
$newCountry = Params::getParam('e_country');
$oldCountry = Params::getParam('country_old');
$exists = $mCountries->findByName($newCountry);
$old_exists = $mCountries->findByName($oldCountry);
if (!isset($exists['pk_c_code']) || $exists['pk_c_code'] == $old_exists['pk_c_code']) {
$mCountries->update(array('s_name' => $newCountry), array('s_name' => $oldCountry));
osc_add_flash_message(sprintf(__('%s has been edited'), $newCountry), 'admin');
} else {
osc_add_flash_message(sprintf(__('%s already was in the database'), $newCountry), 'admin');
}
$this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=locations');
break;
case 'delete_country':
// delete country
$countryId = Params::getParam('id');
// HAS ITEMS?
$has_items = Item::newInstance()->listWhere('l.fk_c_country_code = \'%s\' LIMIT 1', $countryId);
if (!$has_items) {
$mRegions = new Region();
示例7: 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');
$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);
}
示例8: add_comment
public function add_comment()
{
$aItem = $this->prepareDataForFunction('add_comment');
$authorName = trim($aItem['authorName']);
$authorName = strip_tags($authorName);
$authorEmail = trim($aItem['authorEmail']);
$authorEmail = strip_tags($authorEmail);
$body = trim($aItem['body']);
$body = strip_tags($body);
$title = $aItem['title'];
$itemId = $aItem['id'];
$userId = $aItem['userId'];
$status_num = -1;
$item = $this->manager->findByPrimaryKey($itemId);
$itemURL = osc_item_url();
Params::setParam('itemURL', $itemURL);
if ($authorName == '' || !preg_match('|^.*?@.{2,}\\..{2,3}$|', $authorEmail)) {
return 3;
}
if ($body == '') {
return 4;
}
$num_moderate_comments = osc_moderate_comments();
if ($userId == null) {
$num_comments = 0;
} else {
$num_comments = count(ItemComment::newInstance()->findByAuthorID($userId));
}
if ($num_moderate_comments == -1 || $num_moderate_comments != 0 && $num_comments >= $num_moderate_comments) {
$status = 'ACTIVE';
$status_num = 2;
} else {
$status = 'INACTIVE';
$status_num = 1;
}
if (osc_akismet_key()) {
require_once LIB_PATH . 'Akismet.class.php';
$akismet = new Akismet(osc_base_url(), osc_akismet_key());
$akismet->setCommentAuthor($authorName);
$akismet->setCommentAuthorEmail($authorEmail);
$akismet->setCommentContent($body);
$akismet->setPermalink($itemURL);
$status = $akismet->isCommentSpam() ? 'SPAM' : $status;
if ($status == 'SPAM') {
$status_num = 5;
}
}
$mComments = ItemComment::newInstance();
$aComment = array('dt_pub_date' => DB_FUNC_NOW, 'fk_i_item_id' => $itemId, 's_author_name' => $authorName, 's_author_email' => $authorEmail, 's_title' => $title, 's_body' => $body, 'e_status' => $status, 'fk_i_user_id' => $userId);
if ($mComments->insert($aComment)) {
$notify = osc_notify_new_comment();
$admin_email = osc_contact_email();
$prefLocale = osc_language();
//Notify admin
if ($notify) {
$mPages = new Page();
$aPage = $mPages->findByInternalName('email_new_comment_admin');
$locale = osc_current_user_locale();
$content = array();
if (isset($aPage['locale'][$locale]['s_title'])) {
$content = $aPage['locale'][$locale];
} else {
$content = current($aPage['locale']);
}
$words = array();
$words[] = array('{COMMENT_AUTHOR}', '{COMMENT_EMAIL}', '{COMMENT_TITLE}', '{COMMENT_TEXT}', '{ITEM_TITLE}', '{ITEM_ID}', '{ITEM_URL}');
$words[] = array($authorName, $authorEmail, $title, $body, $item['s_title'], $itemId, $itemURL);
$title_email = osc_mailBeauty($content['s_title'], $words);
$body_email = osc_mailBeauty($content['s_text'], $words);
$from = osc_contact_email();
$from_name = osc_page_title();
if (osc_notify_contact_item()) {
$add_bbc = osc_contact_email();
}
$emailParams = array('from' => $admin_email, 'from_name' => __('Admin mail system'), 'subject' => $title_email, 'to' => $admin_email, 'to_name' => __('Admin mail system'), 'body' => $body_email, 'alt_body' => $body_email);
osc_sendMail($emailParams);
}
osc_run_hook('add_comment', $item);
return $status_num;
}
return -1;
}
示例9: osc_current_user_locale
/**
* Get the actual locale of the user.
*
* You get the right locale code. If an user is using the website in another language different of the default one, or
* the user uses the default one, you'll get it.
*
* @return string Locale Code
*/
function osc_current_user_locale()
{
if (Session::newInstance()->_get('userLocale') != '') {
return Session::newInstance()->_get('userLocale');
}
return osc_language();
}
示例10: doModel
//.........这里部分代码省略.........
}
if ($error) {
$result = array('error' => $message);
} else {
$result = array('ok' => __("Saved"));
}
echo json_encode($result);
break;
case 'edit_category_post':
osc_csrf_check(false);
$id = Params::getParam("id");
$fields['i_expiration_days'] = Params::getParam("i_expiration_days") != '' ? Params::getParam("i_expiration_days") : 0;
$fields['b_price_enabled'] = Params::getParam('b_price_enabled') != '' ? 1 : 0;
$apply_changes_to_subcategories = Params::getParam('apply_changes_to_subcategories') == 1 ? true : false;
$error = 0;
$has_one_title = 0;
$postParams = Params::getParamsAsArray();
foreach ($postParams as $k => $v) {
if (preg_match('|(.+?)#(.+)|', $k, $m)) {
if ($m[2] == 's_name') {
if ($v != "") {
$has_one_title = 1;
$aFieldsDescription[$m[1]][$m[2]] = $v;
$s_text = $v;
} else {
$aFieldsDescription[$m[1]][$m[2]] = NULL;
$error = 1;
}
} else {
$aFieldsDescription[$m[1]][$m[2]] = $v;
}
}
}
$l = osc_language();
if ($error == 0 || $error == 1 && $has_one_title == 1) {
$categoryManager = Category::newInstance();
$res = $categoryManager->updateByPrimaryKey(array('fields' => $fields, 'aFieldsDescription' => $aFieldsDescription), $id);
$categoryManager->updateExpiration($id, $fields['i_expiration_days'], $apply_changes_to_subcategories);
$categoryManager->updatePriceEnabled($id, $fields['b_price_enabled'], $apply_changes_to_subcategories);
if (is_bool($res)) {
$error = 2;
}
}
if ($error == 0) {
$msg = __("Category updated correctly");
} else {
if ($error == 1) {
if ($has_one_title == 1) {
$error = 4;
$msg = __('Category updated correctly, but some titles are empty');
} else {
$msg = __('Sorry, including at least a title is mandatory');
}
} else {
if ($error == 2) {
$msg = __('An error occurred while updating');
}
}
}
echo json_encode(array('error' => $error, 'msg' => $msg, 'text' => $aFieldsDescription[$l]['s_name']));
break;
case 'custom':
// Execute via AJAX custom file
if (Params::existParam('route')) {
$routes = Rewrite::newInstance()->getRoutes();
$rid = Params::getParam('route');
示例11: convertAlert
convertAlert($hourly);
}
unset($aAlerts);
$aAlerts = Alerts::newInstance()->findByType('DAILY');
foreach ($aAlerts as $daily) {
convertAlert($daily);
}
unset($aAlerts);
$aAlerts = Alerts::newInstance()->findByType('WEEKLY');
foreach ($aAlerts as $weekly) {
convertAlert($weekly);
}
unset($aAlerts);
// UPDATE COUNTRY PROCESS (remove fk_c_locale)
$comm->query("CREATE TABLE " . DB_TABLE_PREFIX . "t_country_aux (\n pk_c_code CHAR(2) NOT NULL,\n s_name VARCHAR(80) NOT NULL,\n\n PRIMARY KEY (pk_c_code),\n INDEX idx_s_name (s_name)\n) ENGINE=InnoDB DEFAULT CHARACTER SET 'UTF8' COLLATE 'UTF8_GENERAL_CI';");
$rs = $comm->query("SELECT * FROM " . DB_TABLE_PREFIX . "t_country WHERE fk_c_locale_code = '" . osc_language() . "'");
$countries = $rs->result();
foreach ($countries as $c) {
$comm->insert(DB_TABLE_PREFIX . "t_country_aux", array('pk_c_code' => $c['pk_c_code'], 's_name' => $c['s_name']));
}
$rs = $comm->query("SHOW CREATE TABLE " . DB_TABLE_PREFIX . "t_city");
$rs = $rs->result();
foreach ($rs[0] as $r) {
if (preg_match_all('|CONSTRAINT `([^`]+)` FOREIGN KEY \\(`fk_c_country_code`\\) REFERENCES `' . DB_TABLE_PREFIX . 't_country` \\(`pk_c_code`\\)|', $r, $matches)) {
foreach ($matches[1] as $m) {
$comm->query("ALTER TABLE `" . DB_TABLE_PREFIX . "t_city` DROP FOREIGN KEY `" . $m . "`");
}
}
}
$rs = $comm->query("SHOW CREATE TABLE " . DB_TABLE_PREFIX . "t_region");
$rs = $rs->result();
示例12: install
public function install()
{
$confPath = PAYMENT_PRO_PATH . 'payments/';
$dir = opendir($confPath);
while ($file = readdir($dir)) {
if (is_dir($confPath . $file) && $file != '.' && $file != '..') {
if (file_exists($confPath . $file . '/load.php')) {
include_once $confPath . $file . '/load.php';
}
}
}
closedir($dir);
unset($dir);
$this->import(PAYMENT_PRO_PATH . 'struct.sql');
osc_set_preference('version', '200', 'payment_pro', 'INTEGER');
osc_set_preference('default_premium_cost', '1.0', 'payment_pro', 'STRING');
osc_set_preference('allow_premium', '0', 'payment_pro', 'BOOLEAN');
osc_set_preference('default_publish_cost', '1.0', 'payment_pro', 'STRING');
osc_set_preference('pay_per_post', '0', 'payment_pro', 'BOOLEAN');
osc_set_preference('premium_days', '7', 'payment_pro', 'INTEGER');
osc_set_preference('currency', 'USD', 'payment_pro', 'STRING');
osc_set_preference('pack_price_1', '', 'payment_pro', 'STRING');
osc_set_preference('pack_price_2', '', 'payment_pro', 'STRING');
osc_set_preference('pack_price_3', '', 'payment_pro', 'STRING');
osc_set_preference('last_purge', time(), 'payment_pro', 'INTEGER');
osc_run_hook('payment_pro_install');
$limit = 20000;
$this->dao->select('COUNT(*) as total');
$this->dao->from(DB_TABLE_PREFIX . 't_item');
$result = $this->dao->get();
$total = $result->row();
$total = (int) $total['total'];
$steps = ceil($total / $limit);
for ($step = 0; $step < $steps; $step++) {
$this->dao->select('pk_i_id, b_enabled');
$this->dao->from(DB_TABLE_PREFIX . 't_item');
$this->dao->orderBy('pk_i_id', 'ASC');
$this->dao->limit($limit, $limit * $step);
$result = $this->dao->get();
$query = 'INSERT INTO ' . $this->getTable_publish() . ' (fk_i_item_id, b_paid, b_enabled, dt_date) VALUES ';
if ($result) {
$items = $result->result();
$date = date("Y-m-d H:i:s");
$values = array();
$k = 0;
foreach ($items as $key => $item) {
$values[] = '(' . $item['pk_i_id'] . ', 1, ' . $item['b_enabled'] . ', "' . $date . '")';
$k++;
if ($k >= 500) {
$this->dao->query($query . implode(",", $values) . ";");
$k = 0;
$values = array();
}
unset($items[$key]);
}
$this->dao->query($query . implode(",", $values) . ";");
}
}
$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' => 'payment_pro_email_payment', 'b_indelible' => '1'), $description);
}
示例13: _e
<div class="form-row">
<div class="form-label"><?php _e('Page title'); ?></div>
<div class="form-controls"><input type="text" class="xlarge" name="pageTitle" value="<?php echo osc_esc_html( osc_page_title() ); ?>" /></div>
</div>
<div class="form-row">
<div class="form-label"><?php _e('Page description'); ?></div>
<div class="form-controls"><input type="text" class="xlarge" name="pageDesc" value="<?php echo osc_esc_html( osc_page_description() ); ?>" /></div></div>
<div class="form-row">
<div class="form-label"><?php _e('Admin e-mail'); ?></div>
<div class="form-controls"><input type="text" class="large" name="contactEmail" value="<?php echo osc_esc_html( osc_contact_email() ); ?>" /></div></div>
<div class="form-row">
<div class="form-label"><?php _e('Default language'); ?></div>
<div class="form-controls">
<select name="language">
<?php foreach( $aLanguages as $lang ) { ?>
<option value="<?php echo $lang['pk_c_code']; ?>" <?php echo ((osc_language() == $lang['pk_c_code']) ? 'selected="selected"' : ''); ?>><?php echo $lang['s_name']; ?></option>
<?php } ?>
</select>
</div>
</div>
<div class="form-row">
<div class="form-label"><?php _e('Default currency'); ?></div>
<div class="form-controls">
<select name="currency" id="currency_admin">
<?php foreach($aCurrencies as $currency) { ?>
<option value="<?php echo osc_esc_html($currency['pk_c_code']); ?>" <?php echo ((osc_currency() == $currency['pk_c_code']) ? 'selected="selected"' : ''); ?>><?php echo $currency['pk_c_code'] ?></option>
<?php } ?>
</select>
</div>
</div>
<div class="form-row">
示例14: doModel
//.........这里部分代码省略.........
$error = 1;
$message = __('Error while deleting');
}
$result = "{";
if ($error) {
$result .= '"error" : "';
$result .= $message;
$result .= '"';
} else {
$result .= '"ok" : "Saved." ';
}
$result .= "}";
echo $result;
break;
case 'edit_category_post':
$id = Params::getParam("id");
$fields['i_expiration_days'] = Params::getParam("i_expiration_days") != '' ? Params::getParam("i_expiration_days") : 0;
$error = 0;
$postParams = Params::getParamsAsArray();
foreach ($postParams as $k => $v) {
if (preg_match('|(.+?)#(.+)|', $k, $m)) {
if ($m[2] == 's_name') {
if ($v != "") {
$aFieldsDescription[$m[1]][$m[2]] = $v;
} else {
$error = 1;
$message = __("All titles are required");
}
} else {
$aFieldsDescription[$m[1]][$m[2]] = $v;
}
}
}
$l = osc_language();
if (!$error) {
try {
$categoryManager = Category::newInstance();
$categoryManager->updateByPrimaryKey($fields, $aFieldsDescription, $id);
} catch (Exception $e) {
$error = 1;
$message = __("Error while updating.");
}
}
$result = "{";
if ($error) {
$result .= '"error" : "';
$result .= $message;
$result .= '"';
} else {
$result .= '"ok" : "' . __("Saved") . '", "text" : "' . $aFieldsDescription[$l]['s_name'] . '"';
}
$result .= "}";
echo $result;
break;
case 'custom':
// Execute via AJAX custom file
$ajaxfile = Params::getParam("ajaxfile");
if ($ajaxfile != '') {
require_once osc_admin_base_path() . $ajaxfile;
} else {
echo json_encode(array('error' => __('no action defined')));
}
break;
case 'test_mail':
$title = __('Test email') . ", " . osc_page_title();
$body = __("Test email") . "<br><br>" . osc_page_title();
示例15: feed_get_job_data
function feed_get_job_data($item)
{
$conn = getConnection();
$detail = $conn->osc_dbFetchResult("SELECT * FROM %st_item_job_attr WHERE fk_i_item_id = %d", DB_TABLE_PREFIX, $item['pk_i_id']);
if (count($detail) > 0) {
foreach ($detail as $k => $v) {
$item[$k] = $v;
}
}
$detail = $conn->osc_dbFetchResult("SELECT * FROM %st_item_job_description_attr WHERE fk_i_item_id = %d AND fk_c_locale_code = '%s'", DB_TABLE_PREFIX, osc_item_id(), osc_language());
if (count($detail) == 0) {
$detail = $conn->osc_dbFetchResult("SELECT * FROM %st_item_job_description_attr WHERE fk_i_item_id = %d", DB_TABLE_PREFIX, osc_item_id());
}
if (count($detail) > 0) {
foreach ($detail as $k => $v) {
$item[$k] = $v;
}
}
return $item;
}