Example #1
0
 public function extendDataSingle($item)
 {
     $prefLocale = osc_current_user_locale();
     $descriptions = $this->conn->osc_dbFetchResults('SELECT * FROM %st_item_description WHERE fk_i_item_id = %d', DB_TABLE_PREFIX, $item['pk_i_id']);
     $item['locale'] = array();
     foreach ($descriptions as $desc) {
         if ($desc['s_title'] != "" || $desc['s_description'] != "") {
             $item['locale'][$desc['fk_c_locale_code']] = $desc;
         }
     }
     $is_itemLanguageAvailable = !empty($item['locale'][$prefLocale]['s_title']) && !empty($item['locale'][$prefLocale]['s_description']);
     if (isset($item['locale'][$prefLocale]) && $is_itemLanguageAvailable) {
         $item['s_title'] = $item['locale'][$prefLocale]['s_title'];
         $item['s_description'] = $item['locale'][$prefLocale]['s_description'];
     } else {
         $mCategories = new Category();
         $aCategory = $mCategories->findByPrimaryKey($item['fk_i_category_id']);
         $title = sprintf(__('%s in'), $aCategory['s_name']);
         if (isset($item['s_city'])) {
             $title .= ' ' . $item['s_city'];
         } else {
             if (isset($item['s_region'])) {
                 $title .= ' ' . $item['s_region'];
             } else {
                 if (isset($item['s_country'])) {
                     $title .= ' ' . $item['s_country'];
                 }
             }
         }
         $item['s_title'] = $title;
         $item['s_description'] = __('There\'s no description available in your language');
         unset($data);
     }
     return $item;
 }
Example #2
0
 private function processData($pages)
 {
     if (!empty($pages)) {
         $prefLocale = osc_current_user_locale();
         foreach ($pages as $aRow) {
             $row = array();
             $content = array();
             if (isset($aRow['locale'][$prefLocale]) && !empty($aRow['locale'][$prefLocale]['s_title'])) {
                 $content = $aRow['locale'][$prefLocale];
             } else {
                 $content = current($aRow['locale']);
             }
             // -- options --
             $options = array();
             View::newInstance()->_exportVariableToView('page', $aRow);
             $options[] = '<a href="' . osc_static_page_url() . '" target="_blank">' . __('View page') . '</a>';
             $options[] = '<a href="' . osc_admin_base_url(true) . '?page=pages&amp;action=edit&amp;id=' . $aRow['pk_i_id'] . '">' . __('Edit') . '</a>';
             if (!$aRow['b_indelible']) {
                 $options[] = '<a onclick="return delete_dialog(\'' . $aRow['pk_i_id'] . '\');" href="' . osc_admin_base_url(true) . '?page=pages&amp;action=delete&amp;id=' . $aRow['pk_i_id'] . '&amp;' . osc_csrf_token_url() . '">' . __('Delete') . '</a>';
             }
             $auxOptions = '<ul>' . PHP_EOL;
             foreach ($options as $actual) {
                 $auxOptions .= '<li>' . $actual . '</li>' . PHP_EOL;
             }
             $actions = '<div class="actions">' . $auxOptions . '</div>' . PHP_EOL;
             $row['bulkactions'] = '<input type="checkbox" name="id[]"" value="' . $aRow['pk_i_id'] . '"" />';
             $row['internal_name'] = $aRow['s_internal_name'] . $actions;
             $row['title'] = $content['s_title'];
             $row['order'] = '<div class="order-box">' . $aRow['i_order'] . ' <img class="up" onclick="order_up(' . $aRow['pk_i_id'] . ');" src="' . osc_current_admin_theme_url('images/arrow_up.png') . '" alt="' . __('Up') . '" title="' . __('Up') . '" />  <img class="down" onclick="order_down(' . $aRow['pk_i_id'] . ');" src="' . osc_current_admin_theme_url('images/arrow_down.png') . '" alt="' . __('Down') . '" title="' . __('Down') . '" /></div>';
             $row = osc_apply_filter('pages_processing_row', $row, $aRow);
             $this->addRow($row);
             $this->rawRows[] = $aRow;
         }
     }
 }
Example #3
0
/**
 * Send email to user when they get a new PM
 * 
 * @param integer $item
 * @param integer $offer_value 
 *
 * @dynamic tags
 *
 * '{RECIP_NAME}', '{SENDER_NAME}', '{WEB_URL}', '{WEB_TITLE}', '{PM_URL}', '{PM_SUBJECT}', '{PM_MESSAGE}'
 */
function new_pm_email($pm_info)
{
    $mPages = new Page();
    $aPage = $mPages->findByInternalName('email_PM_alert');
    $locale = osc_current_user_locale();
    $content = array();
    if (isset($aPage['locale'][$locale]['s_title'])) {
        $content = $aPage['locale'][$locale];
    } else {
        $content = current($aPage['locale']);
    }
    if ($pm_info['sender_id'] == 0) {
        $sender_name = pmAdmin();
    } else {
        $pm_senderData = User::newInstance()->findByPrimaryKey($pm_info['sender_id']);
        $sender_name = $pm_senderData['s_name'];
    }
    if ($pm_info['recip_id'] == 0) {
        $pm_url = osc_admin_base_url(true) . '?page=plugins&action=renderplugin&file=osclass_pm/admin-send.php?userId=' . $pm_info['sender_id'] . '&mType=adminQuote&messId=' . $pm_info['pm_id'];
        $pm_name = pmAdmin();
        $pm_recipData['s_email'] = osc_contact_email();
    } else {
        $pm_url = osc_base_url(true) . '?page=custom&file=osclass_pm/user-send.php?userId=' . $pm_info['sender_id'] . '&mType=quote&messId=' . $pm_info['pm_id'];
        $pm_recipData = User::newInstance()->findByPrimaryKey($pm_info['recip_id']);
        $pm_name = $pm_recipData['s_name'];
    }
    $pm_url = '<a href="' . $pm_url . '" >' . $pm_url . '</a>';
    $words = array();
    $words[] = array('{RECIP_NAME}', '{SENDER_NAME}', '{WEB_URL}', '{WEB_TITLE}', '{PM_URL}', '{PM_SUBJECT}', '{PM_MESSAGE}', '[quote]', '[/quote]', '[quoteAuthor]', '[/quoteAuthor]');
    $words[] = array($pm_name, $sender_name, osc_base_url(), osc_page_title(), $pm_url, $pm_info['pm_subject'], nl2br($pm_info['pm_message']), '<div class="messQuote">', '</div>', '<div class="quoteAuthor">', '</div>');
    $title = osc_mailBeauty($content['s_title'], $words);
    $body = osc_mailBeauty($content['s_text'], $words);
    $emailParams = array('subject' => $title, 'to' => $pm_recipData['s_email'], 'to_name' => $pm_name, 'body' => $body, 'alt_body' => $body);
    osc_sendMail($emailParams);
}
Example #4
0
 public function __construct($l = "")
 {
     if ($l == "") {
         $l = osc_current_user_locale();
     }
     $this->language = $l;
     parent::__construct();
 }
Example #5
0
 public function listAll($language = "")
 {
     if ($language == '') {
         $language = osc_current_user_locale();
     } else {
         $language = "en_US";
     }
     return $this->conn->osc_dbFetchResults('SELECT * FROM (SELECT *, FIELD(fk_c_locale_code, \'en_US\', \'' . osc_current_user_locale() . '\', \'' . $language . '\') as sorter FROM %s WHERE s_name != \'\' ORDER BY sorter DESC) dummytable GROUP BY pk_c_code ORDER BY s_name ASC', $this->getTableName());
 }
Example #6
0
 public function __construct($l = "")
 {
     if ($l == "") {
         $l = osc_current_user_locale();
     }
     $this->language = $l;
     $this->tree = null;
     $this->relation = null;
     $this->categories = null;
     parent::__construct();
     $this->empty_tree = true;
     $this->toTree();
 }
Example #7
0
 /**
  * Set data related to t_category table
  */
 function __construct($l = '')
 {
     parent::__construct();
     $this->setTableName('t_category');
     $this->setPrimaryKey('pk_i_id');
     $array_fields = array('pk_i_id', 'fk_i_parent_id', 'i_expiration_days', 'i_position', 'b_enabled', 's_icon', 'b_price_enabled');
     $this->setFields($array_fields);
     if ($l == '') {
         $l = osc_current_user_locale();
     }
     $this->_language = $l;
     $this->_tree = null;
     $this->_relation = null;
     $this->_categories = null;
     $this->_emptyTree = true;
     $this->toTree();
 }
Example #8
0
 public function listAllAdmin($language = "")
 {
     if ($language == '') {
         $language = osc_current_user_locale();
     } else {
         $language = 'en_US';
     }
     $countries_temp = $this->conn->osc_dbFetchResults('SELECT * FROM (SELECT *, FIELD(fk_c_locale_code, \'en_US\', \'' . osc_current_user_locale() . '\', \'' . $language . '\') as sorter FROM %s WHERE s_name != \'\' ORDER BY sorter DESC) dummytable GROUP BY pk_c_code ORDER BY s_name ASC', $this->getTableName());
     $countries = array();
     foreach ($countries_temp as $country) {
         $locales = $this->conn->osc_dbFetchResults("SELECT * FROM %s WHERE pk_c_code = '%s'", $this->getTableName(), $country['pk_c_code']);
         foreach ($locales as $locale) {
             $country['locales'][$locale['fk_c_locale_code']] = $locale['s_name'];
         }
         $countries[] = $country;
     }
     return $countries;
 }
Example #9
0
 function __construct($install = false)
 {
     if (!$install) {
         // get user/admin locale
         if (OC_ADMIN) {
             $locale = osc_current_admin_locale();
         } else {
             $locale = osc_current_user_locale();
         }
         // load core
         $core_file = osc_translations_path() . $locale . '/core.mo';
         $this->_load($core_file, 'core');
         // load messages
         $messages_file = osc_themes_path() . osc_theme() . '/languages/' . $locale . '/messages.mo';
         if (!file_exists($messages_file)) {
             $messages_file = osc_translations_path() . $locale . '/messages.mo';
         }
         $this->_load($messages_file, 'messages');
         // load theme
         $domain = osc_theme();
         $theme_file = osc_themes_path() . $domain . '/languages/' . $locale . '/theme.mo';
         if (!file_exists($theme_file)) {
             if (!file_exists(osc_themes_path() . $domain)) {
                 $domain = 'modern';
             }
             $theme_file = osc_translations_path() . $locale . '/theme.mo';
         }
         $this->_load($theme_file, $domain);
         // load plugins
         $aPlugins = Plugins::listInstalled();
         foreach ($aPlugins as $plugin) {
             $domain = preg_replace('|/.*|', '', $plugin);
             $plugin_file = osc_plugins_path() . $domain . '/languages/' . $locale . '/messages.mo';
             if (file_exists($plugin_file)) {
                 $this->_load($plugin_file, $domain);
             }
         }
     } else {
         $core_file = osc_translations_path() . osc_current_admin_locale() . '/core.mo';
         $this->_load($core_file, 'core');
     }
 }
Example #10
0
 private function toArrayFormat()
 {
     $this->result['iTotalRecords'] = $this->total;
     $this->result['iTotalDisplayRecords'] = $this->total_filtered;
     $this->result['iDisplayLength'] = $this->_get['iDisplayLength'];
     $this->result['aaData'] = array();
     if (count($this->pages) == 0) {
         return;
     }
     $prefLocale = osc_current_user_locale();
     $count = 0;
     foreach ($this->pages as $aRow) {
         $row = array();
         $content = array();
         if (isset($aRow['locale'][$prefLocale]) && !empty($aRow['locale'][$prefLocale]['s_title'])) {
             $content = $aRow['locale'][$prefLocale];
         } else {
             $content = current($aRow['locale']);
         }
         // -- options --
         $options = array();
         View::newInstance()->_exportVariableToView('page', $aRow);
         $options[] = '<a href="' . osc_static_page_url() . '" target="_blank">' . __('View page') . '</a>';
         $options[] = '<a href="' . osc_admin_base_url(true) . '?page=pages&amp;action=edit&amp;id=' . $aRow['pk_i_id'] . '">' . __('Edit') . '</a>';
         if (!$aRow['b_indelible']) {
             $options[] = '<a onclick="return delete_dialog(\'' . $aRow['pk_i_id'] . '\');" href="' . osc_admin_base_url(true) . '?page=pages&amp;action=delete&amp;id=' . $aRow['pk_i_id'] . '">' . __('Delete') . '</a>';
         }
         $auxOptions = '<ul>' . PHP_EOL;
         foreach ($options as $actual) {
             $auxOptions .= '<li>' . $actual . '</li>' . PHP_EOL;
         }
         $actions = '<div class="actions">' . $auxOptions . '</div>' . PHP_EOL;
         $row[] = '<input type="checkbox" name="id[]"" value="' . $aRow['pk_i_id'] . '"" />';
         $row[] = $aRow['s_internal_name'] . $actions;
         $row[] = $content['s_title'];
         $row[] = '<div class="order-box">' . $aRow['i_order'] . ' <img class="up" onclick="order_up(' . $aRow['pk_i_id'] . ');" src="' . osc_current_admin_theme_url('images/arrow_up.png') . '" alt="' . __('Up') . '" title="' . __('Up') . '" />  <img class="down" onclick="order_down(' . $aRow['pk_i_id'] . ');" src="' . osc_current_admin_theme_url('images/arrow_down.png') . '" alt="' . __('Down') . '" title="' . __('Down') . '" /></div>';
         $this->result['aaData'][] = $row;
     }
 }
function email_link_problem($url_from, $url_to, $contact)
{
    $page = new Page();
    $page = $page->findByInternalName('seo_link_problem');
    if (empty($page)) {
        exit;
    }
    $locale = osc_current_user_locale();
    $content = array();
    if (isset($page['locale'][$locale]['s_title'])) {
        $content = $page['locale'][$locale];
    } else {
        $content = current($page['locale']);
    }
    $words = array();
    $words[] = array('{LINK_FROM}', '{LINK_TO}');
    $words[] = array($url_from, $url_to);
    $title = osc_mailBeauty($content['s_title'], $words);
    $body = osc_mailBeauty($content['s_text'], $words);
    $email_build = array('subject' => $title, 'to' => $contact, 'to_name' => 'Partner', 'body' => $body, 'alt_body' => $body);
    osc_sendMail($email_build);
}
Example #12
0
 public static function language_selector($value = NULL)
 {
     $name = 'new_item[gn_lang]';
     self::setInputValueFor('gn_lang', $value);
     $locales = osc_all_enabled_locales_for_admin();
     if ($value == NULL) {
         $value = osc_current_user_locale();
     }
     if (count($locales) > 1) {
         echo '<select name="' . $name . '" id="news_lang_selector">';
         foreach ($locales as $locale) {
             $selected = '';
             if ($value == $locale['pk_c_code']) {
                 $selected = 'selected="selected"';
             }
             echo '<option value="' . $locale['pk_c_code'] . '" ' . $selected . '>' . $locale['s_short_name'] . '</option>';
         }
         echo '</select>';
     } else {
         echo $locales[0]['s_short_name'];
         parent::generic_input_hidden('locale', $locales[0]['pk_c_code']);
     }
 }
Example #13
0
          </label>
          <div class="controls">
            <?php 
UserForm::website_text(osc_user());
?>
          </div>
        </div>
        <div class="form-group">
          <label class="control-label" for="s_info">
            <?php 
_e('Description', OSCLASSWIZARDS_THEME_FOLDER);
?>
          </label>
          <div class="controls">
            <?php 
UserForm::info_textarea('s_info', osc_current_user_locale(), @$osc_user['locale'][osc_current_user_locale()]['s_info']);
?>
          </div>
        </div>
        <?php 
osc_run_hook('user_profile_form', osc_user());
?>
        <div class="form-group">
          <div class="controls">
            <button type="submit" class="btn btn-success">
            <?php 
_e("Update", OSCLASSWIZARDS_THEME_FOLDER);
?>
            </button>
          </div>
        </div>
Example #14
0
 /**
  *
  */
 function __construct($expired = false)
 {
     parent::__construct();
     $this->setTableName('t_item');
     $this->setFields(array('pk_i_id'));
     $this->withPattern = false;
     $this->withLocations = false;
     $this->withCategoryId = false;
     $this->withUserId = false;
     $this->withPicture = false;
     $this->withNoUserEmail = false;
     $this->price_min = null;
     $this->price_max = null;
     $this->user_ids = null;
     $this->itemId = null;
     $this->city_areas = array();
     $this->cities = array();
     $this->regions = array();
     $this->countries = array();
     $this->categories = array();
     $this->conditions = array();
     $this->tables = array();
     $this->tables_join = array();
     $this->search_fields = array();
     $this->itemConditions = array();
     $this->groupBy = '';
     $this->having = '';
     $this->order();
     $this->limit();
     $this->results_per_page = 10;
     if (!$expired) {
         // t_item
         $this->addItemConditions(sprintf("%st_item.b_enabled = 1 ", DB_TABLE_PREFIX));
         $this->addItemConditions(sprintf("%st_item.b_active = 1 ", DB_TABLE_PREFIX));
         $this->addItemConditions(sprintf("%st_item.b_spam = 0", DB_TABLE_PREFIX));
         $this->addItemConditions(sprintf("(%st_item.b_premium = 1 || %st_item.dt_expiration >= '%s')", DB_TABLE_PREFIX, DB_TABLE_PREFIX, date('Y-m-d H:i:s')));
     }
     $this->total_results = null;
     $this->total_results_table = null;
     // get all item_location data
     if (OC_ADMIN) {
         $this->addField(sprintf('%st_item_location.*', DB_TABLE_PREFIX));
         $this->locale_code = osc_current_admin_locale();
     } else {
         $this->locale_code = osc_current_user_locale();
     }
 }
/**
 * Return layout optimized for sidebar at main web page, with the best user voted with a limit
 *
 * @param int $num number of users
 */
function echo_users_best_rated($num = 5)
{
    if (osc_get_preference('user_voting', 'voting') == 1) {
        $filter = array('order' => 'desc', 'num_items' => $num);
        $results = get_user_votes($filter);
        if (count($results) > 0) {
            $locale = osc_current_user_locale();
            require 'set_results_user.php';
        }
    }
}
Example #16
0
function fn_email_new_comment_user($aItem)
{
    $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'];
    $admin_email = osc_contact_email();
    $prefLocale = osc_language();
    $item = Item::newInstance()->findByPrimaryKey($itemId);
    View::newInstance()->_exportVariableToView('item', $item);
    $itemURL = osc_item_url();
    $itemURL = '<a href="' . $itemURL . '" >' . $itemURL . '</a>';
    $mPages = new Page();
    $aPage = $mPages->findByInternalName('email_new_comment_user');
    $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}', '{SELLER_NAME}', '{SELLER_EMAIL}');
    $words[] = array($authorName, $authorEmail, $title, $body, $item['s_title'], $itemId, $itemURL, $item['s_contact_name'], $item['s_contact_email']);
    $title_email = osc_mailBeauty(osc_apply_filter('email_title', osc_apply_filter('email_new_comment_user_title', $content['s_title'])), $words);
    $body_email = osc_mailBeauty(osc_apply_filter('email_description', osc_apply_filter('email_new_comment_user_description', $content['s_text'])), $words);
    $from = osc_contact_email();
    $from_name = osc_page_title();
    $emailParams = array('from' => $admin_email, 'from_name' => __('Admin mail system'), 'subject' => $title_email, 'to' => $item['s_contact_email'], 'to_name' => $item['s_contact_name'], 'body' => $body_email, 'alt_body' => $body_email);
    osc_sendMail($emailParams);
}
Example #17
0
        /**
         * Extends the given array $items with description in available locales
         *
         * @access public
         * @since unknown
         * @param type $items
         * @return array with description extended with all available locales
         */
        public function extendData($items)
        {
            if( OC_ADMIN ) {
                $prefLocale = osc_current_admin_locale();
            } else {
                $prefLocale = osc_current_user_locale();
            }

            $results = array();

            foreach ($items as $item) {
                $this->dao->select();
                $this->dao->from(DB_TABLE_PREFIX.'t_item_description');
                $this->dao->where(DB_TABLE_PREFIX.'t_item_description.fk_i_item_id', $item['pk_i_id']);

                $result = $this->dao->get();
                $descriptions = $result->result();

                $item['locale'] = array();
                foreach ($descriptions as $desc) {
                    if ($desc['s_title'] != "" || $desc['s_description'] != "") {
                        $item['locale'][$desc['fk_c_locale_code']] = $desc;
                    }
                }
                if (isset($item['locale'][$prefLocale])) {
                    $item['s_title'] = $item['locale'][$prefLocale]['s_title'];
                    $item['s_description'] = $item['locale'][$prefLocale]['s_description'];
                } else {
                    $data = current($item['locale']);
                    $item['s_title'] = $data['s_title'];
                    $item['s_description'] = $data['s_description'];
                    unset($data);
                }

                // populate locations and category_name
                $this->dao->select(DB_TABLE_PREFIX.'t_item_location.*, cd.s_name as s_category_name');
                // select sum item_stats
                $this->dao->select('SUM(`s`.`i_num_views`) as `i_num_views`' );
                $this->dao->select('SUM(`s`.`i_num_spam`) as `i_num_spam`' );
                $this->dao->select('SUM(`s`.`i_num_bad_classified`) as `i_num_bad_classified`' );
                $this->dao->select('SUM(`s`.`i_num_repeated`) as `i_num_repeated`' );
                $this->dao->select('SUM(`s`.`i_num_offensive`) as `i_num_offensive`' );
                $this->dao->select('SUM(`s`.`i_num_expired`) as `i_num_expired` ' );
                $this->dao->select('SUM(`s`.`i_num_premium_views`) as `i_num_premium_views` ' );

                $this->dao->from(DB_TABLE_PREFIX.'t_item_location');
                $this->dao->from(DB_TABLE_PREFIX.'t_category_description as cd');
                $this->dao->from(DB_TABLE_PREFIX.'t_item_stats as s');
                $this->dao->where(DB_TABLE_PREFIX.'t_item_location.fk_i_item_id', $item['pk_i_id']);
//                $this->dao->where(DB_TABLE_PREFIX.'t_item_stats.fk_i_item_id', $item['pk_i_id']);
                $this->dao->where('s.fk_i_item_id', $item['pk_i_id']);
                $this->dao->where('cd.fk_i_category_id', $item['fk_i_category_id']);
                // group by item_id
                $this->dao->groupBy('fk_i_item_id');

                $result = $this->dao->get();
                $extraFields = $result->row();

                foreach($extraFields as $key => $value) {
                    $item[$key] = $value;
                }

                $results[] = $item;
            }
            return $results;
        }
Example #18
0
function fn_email_item_validation_non_register_user($item)
{
    View::newInstance()->_exportVariableToView('item', $item);
    $mPages = new Page();
    $aPage = $mPages->findByInternalName('email_item_validation_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_url = osc_item_url();
    $item_url = '<a href="' . $item_url . '" >' . $item_url . '</a>';
    $edit_url = osc_item_edit_url($item['s_secret'], $item['pk_i_id']);
    $delete_url = osc_item_delete_url($item['s_secret'], $item['pk_i_id']);
    $all = '';
    if (isset($item['locale'])) {
        foreach ($item['locale'] as $locale => $data) {
            $locale_name = OSCLocale::newInstance()->listWhere("pk_c_code = '" . $locale . "'");
            $all .= '<br/>';
            if (isset($locale_name[0]) && isset($locale_name[0]['s_name'])) {
                $all .= __('Language') . ': ' . $locale_name[0]['s_name'] . '<br/>';
            } else {
                $all .= __('Language') . ': ' . $locale . '<br/>';
            }
            $all .= __('Title') . ': ' . $data['s_title'] . '<br/>';
            $all .= __('Description') . ': ' . $data['s_description'] . '<br/>';
            $all .= '<br/>';
        }
    } else {
        $all .= __('Title') . ': ' . $item['s_title'] . '<br/>';
        $all .= __('Description') . ': ' . $item['s_description'] . '<br/>';
    }
    // Format activation URL
    $validation_url = osc_item_activate_url($item['s_secret'], $item['pk_i_id']);
    $words = array();
    $words[] = array('{ITEM_DESCRIPTION_ALL_LANGUAGES}', '{ITEM_DESCRIPTION}', '{ITEM_COUNTRY}', '{ITEM_PRICE}', '{ITEM_REGION}', '{ITEM_CITY}', '{ITEM_ID}', '{USER_NAME}', '{USER_EMAIL}', '{WEB_URL}', '{ITEM_TITLE}', '{ITEM_URL}', '{WEB_TITLE}', '{VALIDATION_LINK}', '{VALIDATION_URL}', '{EDIT_LINK}', '{EDIT_URL}', '{DELETE_LINK}', '{DELETE_URL}');
    $words[] = array($all, $item['s_description'], $item['s_country'], osc_prepare_price($item['s_price']), $item['s_region'], $item['s_city'], $item['pk_i_id'], $item['s_contact_name'], $item['s_contact_email'], '<a href="' . osc_base_url() . '" >' . osc_base_url() . '</a>', $item['s_title'], $item_url, osc_page_title(), '<a href="' . $validation_url . '" >' . $validation_url . '</a>', $validation_url, '<a href="' . $edit_url . '">' . $edit_url . '</a>', $edit_url, '<a href="' . $delete_url . '">' . $delete_url . '</a>', $delete_url);
    $title = osc_mailBeauty(osc_apply_filter('email_title', osc_apply_filter('email_item_validation_non_register_user_title', $content['s_title'])), $words);
    $body = osc_mailBeauty(osc_apply_filter('email_description', osc_apply_filter('email_item_validation_non_register_user_description', $content['s_text'])), $words);
    $emailParams = array('subject' => $title, 'to' => $item['s_contact_email'], 'to_name' => $item['s_contact_name'], 'body' => $body, 'alt_body' => $body);
    osc_sendMail($emailParams);
}
Example #19
0
 public function getLastComments($num)
 {
     if (!intval($num)) {
         return false;
     }
     $lang = osc_current_user_locale();
     return $this->conn->osc_dbFetchResults('SELECT i.*, d.s_title
             FROM %st_item_comment i
             JOIN %st_item c ON c.pk_i_id = i.fk_i_item_id
             JOIN %st_item_description d ON d.fk_i_item_id = i.fk_i_item_id
             GROUP BY d.fk_i_item_id 
             ORDER BY pk_i_id DESC LIMIT 0, ' . $num . '', DB_TABLE_PREFIX, DB_TABLE_PREFIX, DB_TABLE_PREFIX);
 }
Example #20
0
/**
 * Gets current locale object
 *
 * @return array
 */
function osc_get_current_user_locale()
{
    $locale = OSCLocale::newInstance()->findByPrimaryKey(osc_current_user_locale());
    View::newInstance()->_exportVariableToView('locale', $locale);
    return $locale;
}
Example #21
0
                                <?php 
ItemForm::title_input('title', osc_current_user_locale(), osc_esc_html(bender_item_title()));
?>
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label" for="description[<?php 
echo osc_current_user_locale();
?>
]"><?php 
_e('Description', 'bender');
?>
</label>
                            <div class="controls">
                                <?php 
ItemForm::description_textarea('description', osc_current_user_locale(), osc_esc_html(bender_item_description()));
?>
                            </div>
                        </div>
                        <?php 
if (osc_price_enabled_at_items()) {
    ?>
                        <div class="control-group control-group-price">
                            <label class="control-label" for="price"><?php 
    _e('Price', 'bender');
    ?>
</label>
                            <div class="controls">
                                <?php 
    ItemForm::price_input_text();
    ?>
Example #22
0
    function fn_email_warn_expiration($aItem) {
        $itemId      = $aItem['pk_i_id'];
        $admin_email = osc_contact_email();

        View::newInstance()->_exportVariableToView('item', $aItem);
        $itemURL = osc_item_url();
        $itemURL = '<a href="'.$itemURL.'" >'.$itemURL.'</a>';

        $mPages = new Page();
        $aPage = $mPages->findByInternalName('email_warn_expiration');
        $locale = osc_current_user_locale();

        if(isset($aPage['locale'][$locale]['s_title'])) {
            $content = $aPage['locale'][$locale];
        } else {
            $content = current($aPage['locale']);
        }

        $words   = array();
        $words[] = array(
            '{USER_NAME}',
            '{ITEM_TITLE}',
            '{ITEM_ID}',
            '{ITEM_EXPIRATION_DATE}',
            '{ITEM_URL}',
            '{ITEM_LINK}',
            '{SELLER_NAME}',
            '{SELLER_EMAIL}',
            '{CONTACT_NAME}',
            '{CONTACT_EMAIL}'
        );
        $words[] = array(
            $aItem['s_contact_name'],
            $aItem['s_title'],
            $itemId,
            $aItem['dt_expiration'],
            osc_item_url(),
            $itemURL,
            $aItem['s_contact_name'],
            $aItem['s_contact_email'],
            $aItem['s_contact_name'],
            $aItem['s_contact_email']
        );
        $title_email = osc_apply_filter('email_warn_expiration_title_after', osc_mailBeauty(osc_apply_filter('email_title', osc_apply_filter('email_warn_expiration_title', $content['s_title'], $aItem)), $words), $aItem);
        $body_email = osc_apply_filter('email_warn_expiration_description_after', osc_mailBeauty(osc_apply_filter('email_description', osc_apply_filter('email_warn_expiration_description', $content['s_text'], $aItem)), $words), $aItem);

        $emailParams = array(
            'from'      => $admin_email,
            'subject'   => $title_email,
            'to'        => $aItem['s_contact_email'],
            'to_name'   => $aItem['s_contact_name'],
            'body'      => $body_email,
            'alt_body'  => $body_email
        );
        osc_sendMail($emailParams);
    }
Example #23
0
/**
 * Gets description/information of current user
 *
 * @return string
 */
function osc_user_info($locale = "")
{
    if ($locale == "") {
        $locale = osc_current_user_locale();
    }
    $info = osc_user_field("s_info", $locale);
    if ($info == '') {
        $info = osc_user_field("s_info", osc_language());
        if ($info == '') {
            $aLocales = osc_get_locales();
            foreach ($aLocales as $locale) {
                $info = osc_user_field("s_info", $locale['pk_c_code']);
                if ($info != '') {
                    break;
                }
            }
        }
    }
    return (string) $info;
}
function payment_pro_send_email($email)
{
    $item = Item::newInstance()->findByPrimaryKey($email['fk_i_item_id']);
    $mPages = new Page();
    $aPage = $mPages->findByInternalName('payment_pro_email_payment');
    $locale = osc_current_user_locale();
    $content = array();
    if (isset($aPage['locale'][$locale]['s_title'])) {
        $content = $aPage['locale'][$locale];
    } else {
        $content = current($aPage['locale']);
    }
    $item_url = osc_item_url();
    $item_url = '<a href="' . $item_url . '" >' . $item_url . '</a>';
    $publish_url = osc_route_url('payment-pro-addcart', array('item' => 'PUB' . $item['fk_i_category_id'] . '-' . $item['pk_i_id']));
    $premium_url = osc_route_url('payment-pro-addcart', array('item' => 'PRM' . $item['fk_i_category_id'] . '-' . $item['pk_i_id']));
    $words = array();
    $words[] = array('{ITEM_ID}', '{CONTACT_NAME}', '{CONTACT_EMAIL}', '{WEB_URL}', '{ITEM_TITLE}', '{ITEM_URL}', '{WEB_TITLE}', '{PUBLISH_LINK}', '{PUBLISH_URL}', '{PREMIUM_LINK}', '{PREMIUM_URL}', '{START_PUBLISH_FEE}', '{END_PUBLISH_FEE}', '{START_PREMIUM_FEE}', '{END_PREMIUM_FEE}');
    $words[] = array($item['pk_i_id'], $item['s_contact_name'], $item['s_contact_email'], osc_base_url(), $item['s_title'], $item_url, osc_page_title(), '<a href="' . $publish_url . '">' . $publish_url . '</a>', $publish_url, '<a href="' . $premium_url . '">' . $premium_url . '</a>', $premium_url, '', '', '', '');
    if ($email['b_publish'] == 0) {
        $content['s_text'] = preg_replace('|{START_PUBLISH_FEE}(.*){END_PUBLISH_FEE}|', '', $content['s_text']);
    }
    if ($email['b_premium'] == 0) {
        $content['s_text'] = preg_replace('|{START_PREMIUM_FEE}(.*){END_PREMIUM_FEE}|', '', $content['s_text']);
    }
    $title = osc_apply_filter('alert_email_payment_pro_title_after', osc_mailBeauty(osc_apply_filter('email_payment_pro_title', osc_apply_filter('alert_email_payment_pro_title', $content['s_title'], $email, $item)), $words), $email, $item);
    $body = osc_apply_filter('alert_email_payment_pro_description_after', osc_mailBeauty(osc_apply_filter('email_payment_pro_description', osc_apply_filter('alert_email_payment_pro_description', $content['s_text'], $email, $item)), $words), $email, $item);
    $emailParams = array('subject' => $title, 'to' => $item['s_contact_email'], 'to_name' => $item['s_contact_name'], 'body' => $body, 'alt_body' => $body);
    osc_sendMail($emailParams);
}
Example #25
0
function osclasswizards_item_post_form_validate()
{
    ?>
<script type="text/javascript">
	$(document).ready(function(){
		$('#regionId, #cityId').removeAttr('disabled');
	});

	//form validate
	$('form[name=item]').validate({
		rules: {
			catId: {
				required: true,
				digits: true
			},
			'title[<?php 
    echo osc_current_user_locale();
    ?>
]': {
				required:true,
				minlength:<?php 
    echo osclasswizards_title_minimum_length();
    ?>
			},
			'description[<?php 
    echo osc_current_user_locale();
    ?>
]': {
				minlength:<?php 
    echo osclasswizards_description_minimum_length();
    ?>
			},
			price: {
				maxlength: 50
			},
			currency: "required",
			"photos[]": {
				accept: "png,gif,jpg,jpeg"
			},
			contactName: {
				required: true,
				minlength: 3,
				maxlength: 35
			},
			contactEmail: {
				required: true,
				email: true
			},
			countryId:{
				required: <?php 
    echo osclasswizards_locations_required();
    ?>
			},
			region: {
				required: <?php 
    echo osclasswizards_locations_required();
    ?>
,
				minlength: 3,
				maxlength: 100
			},
			city: {
				required: <?php 
    echo osclasswizards_locations_required();
    ?>
,
				minlength: 3,
				maxlength: 1000
			}
			<?php 
    if (osclasswizards_locations_input_as() == 'select') {
        ?>
			,
			regionId: {
				required: <?php 
        echo osclasswizards_locations_required();
        ?>
			},
			cityId: {
				required: <?php 
        echo osclasswizards_locations_required();
        ?>
			}
			<?php 
    }
    ?>
			
		},
		messages: {
			catId: {
			required: "<?php 
    echo osc_esc_js(__("Choose one category", OSCLASSWIZARDS_THEME_FOLDER));
    ?>
."
			},
			'title[<?php 
    echo osc_current_user_locale();
    ?>
]': {
				required: "<?php 
    echo osc_esc_js(__("Title: this field is required", OSCLASSWIZARDS_THEME_FOLDER));
    ?>
.",
				minlength: "<?php 
    echo osc_esc_js(__("Title too short", OSCLASSWIZARDS_THEME_FOLDER));
    ?>
."
			},
			'description[<?php 
    echo osc_current_user_locale();
    ?>
]': {
				minlength: "<?php 
    echo osc_esc_js(__("Description too short", OSCLASSWIZARDS_THEME_FOLDER));
    ?>
."
			},
			price: {
				maxlength: "<?php 
    echo osc_esc_js(__("Price: no more than 50 characters", OSCLASSWIZARDS_THEME_FOLDER));
    ?>
."
			},
			currency: "<?php 
    echo osc_esc_js(__("Currency: make your selection", OSCLASSWIZARDS_THEME_FOLDER));
    ?>
.",
			"photos[]": {
				accept: "<?php 
    echo osc_esc_js(__("Photo: must be png,gif,jpg,jpeg", OSCLASSWIZARDS_THEME_FOLDER));
    ?>
."
			},
			contactName: {
				required: "<?php 
    echo osc_esc_js(__("Name: this field is required", OSCLASSWIZARDS_THEME_FOLDER));
    ?>
.",
				minlength: "<?php 
    echo osc_esc_js(__("Name: enter at least 3 characters", OSCLASSWIZARDS_THEME_FOLDER));
    ?>
.",
				maxlength: "<?php 
    echo osc_esc_js(__("Name: no more than 35 characters", OSCLASSWIZARDS_THEME_FOLDER));
    ?>
."
			},
			contactEmail: {
				required: "<?php 
    echo osc_esc_js(__("Email: this field is required", OSCLASSWIZARDS_THEME_FOLDER));
    ?>
.",
				email: "<?php 
    echo osc_esc_js(__("Invalid email address", OSCLASSWIZARDS_THEME_FOLDER));
    ?>
."
			},
			countryId: {
				required: "<?php 
    echo osc_esc_js(__("Please select a stream", OSCLASSWIZARDS_THEME_FOLDER));
    ?>
."
			},
			region: {
				required: "<?php 
    echo osc_esc_js(__("Region: this field is required", OSCLASSWIZARDS_THEME_FOLDER));
    ?>
.",
				minlength: "<?php 
    echo osc_esc_js(__("Region: enter at least 3 characters", OSCLASSWIZARDS_THEME_FOLDER));
    ?>
.",
				maxlength: "<?php 
    echo osc_esc_js(__("Region: no more than 100 characters", OSCLASSWIZARDS_THEME_FOLDER));
    ?>
."
			},
			city: {
				required: "<?php 
    echo osc_esc_js(__("City: this field is required", OSCLASSWIZARDS_THEME_FOLDER));
    ?>
.",
				minlength: "<?php 
    echo osc_esc_js(__("City: enter at least 3 characters", OSCLASSWIZARDS_THEME_FOLDER));
    ?>
.",
				maxlength: "<?php 
    echo osc_esc_js(__("City: no more than 100 characters", OSCLASSWIZARDS_THEME_FOLDER));
    ?>
."
			}
			<?php 
    if (osclasswizards_locations_input_as() == 'select') {
        ?>
			,
			regionId: {
				required: "<?php 
        echo osc_esc_js(__("Region: this field is required", OSCLASSWIZARDS_THEME_FOLDER));
        ?>
."
			},
			cityId: {
				required: "<?php 
        echo osc_esc_js(__("City: this field is required", OSCLASSWIZARDS_THEME_FOLDER));
        ?>
."
			}
			<?php 
    }
    ?>
		},
		errorLabelContainer: "#error_list",
		wrapper: "li",
		invalidHandler: function(form, validator) {
			$('html,body').animate({ scrollTop: $('h1').offset().top }, { duration: 250, easing: 'swing'});
		},
		submitHandler: function(form){
			$('button[type=submit], input[type=submit]').attr('disabled', 'disabled');
			setTimeout("$('button[type=submit], input[type=submit]').removeAttr('disabled')", 5000);
			form.submit();
		}
	});
</script>
<?php 
}
Example #26
0
 
        </strong> <span>
        <?php 
    $local = osc_get_current_user_locale();
    echo $local['s_name'];
    ?>
        <i class="fa fa-caret-down"></i></span>
        <ul>
          <?php 
    $i = 0;
    ?>
          <?php 
    while (osc_has_web_enabled_locales()) {
        ?>
          <li><a <?php 
        if (osc_locale_code() == osc_current_user_locale()) {
            echo "class=active";
        }
        ?>
 id="<?php 
        echo osc_locale_code();
        ?>
" href="<?php 
        echo osc_change_language_url(osc_locale_code());
        ?>
"><?php 
        echo osc_locale_name();
        ?>
</a></li>
          <?php 
        if ($i == 0) {
Example #27
0
/**
 * Gets category description from current premium, if $locale is unspecified $locale is current user locale
 *
 * @param type $locale
 * @return string 
 */
function osc_premium_category_description($locale = "")
{
    if ($locale == "") {
        $locale = osc_current_user_locale();
    }
    if (!View::newInstance()->_exists('premium_category')) {
        View::newInstance()->_exportVariableToView('premium_category', Category::newInstance()->findByPrimaryKey(osc_premium_category_id()));
    }
    $category = View::newInstance()->_get('premium_category');
    return osc_field($category, "s_description", $locale);
}
Example #28
0
/**
 * Gets the slug of the current category. WARNING: This slug could NOT be used as a valid W3C HTML tag attribute as it could have other characters besides [A-Za-z0-9-_] We only did a urlencode to the variable
 *
 * @param string $locale
 * @return string
 */
function osc_category_slug($locale = "")
{
    if ($locale == "") {
        $locale = osc_current_user_locale();
    }
    return osc_category_field("s_slug", $locale);
}
Example #29
0
<!DOCTYPE html>
<html dir="ltr" lang="<?php 
echo str_replace('_', '-', osc_current_user_locale());
?>
">
    <head>
        <?php 
osc_current_web_theme_path('head.php');
?>
        <meta name="robots" content="noindex, nofollow" />
        <meta name="googlebot" content="noindex, nofollow" />
    </head>
    <body>
        <?php 
osc_current_web_theme_path('header.php');
?>
        <div class="container user">
            <div class="row">
                <div class="span16 columns">
                    <?php 
twitter_user_menu();
?>
                    <?php 
twitter_show_flash_message();
?>
                    <form action="<?php 
echo osc_base_url(true);
?>
" method="post" onsubmit="return doUserChangePassword() ;">
                        <input type="hidden" name="page" value="user" />
                        <input type="hidden" name="action" value="change_password_post" />
Example #30
0
/**
 * Gets current locale object
 *
 * @return array
 */
function osc_get_current_user_locale()
{
    View::newInstance()->_exportVariableToView('locale', OSCLocale::newInstance()->findByPrimaryKey(osc_current_user_locale()));
}