コード例 #1
0
ファイル: listings.php プロジェクト: mozdial/Directory
/**
* @project ApPHP Business Directory
* @copyright (c) 2011 ApPHP
* @author ApPHP <*****@*****.**>
* @license http://www.gnu.org/licenses/
*/
// *** Make sure the file isn't accessed directly
defined('APPHP_EXEC') or die('Restricted Access');
//--------------------------------------------------------------------------
$listing_type = Application::Get('type');
$listing_type_title = '';
if ($listing_type == 'featured') {
    $listing_type_title = _FEATURED_LISTINGS;
} else {
    if ($listing_type == 'recent') {
        $listing_type_title = _RECENT_LISTINGS;
    }
}
draw_title_bar(prepare_breadcrumbs(array(_LISTINGS => '', $listing_type_title => '')));
if (!empty($listing_type_title)) {
    if ($listing_type == 'featured') {
        Listings::DrawFeaturedAll();
    } else {
        if ($listing_type == 'recent') {
            Listings::DrawRecentAll();
        }
    }
} else {
    draw_important_message(_PAGE_UNKNOWN);
}
コード例 #2
0
ファイル: edit.pre.php プロジェクト: amillionmonkeys/perchd
<?php

$HTML = $API->get('HTML');
$Form = $API->get('Form');
$message = false;
$Listings = new Listings();
if (!$CurrentUser->has_priv('listings.moderate')) {
    PerchUtil::redirect($API->app_path());
}
if (isset($_GET['id']) && $_GET['id'] != '') {
    $listingID = (int) $_GET['id'];
    $Listing = $Listings->find($listingID);
    $details = $Listing->to_array();
} else {
    $message = $HTML->failure_message('Sorry, that comment could not be found.');
}
$Template = $API->get('Template');
$Template->set('listings/listing.html', 'listing');
$Form->handle_empty_block_generation($Template);
$tags = $Template->find_all_tags_and_repeaters();
$Form->set_required_fields_from_template($Template, $details);
if ($Form->submitted()) {
    $fixed_fields = $Form->receive(array('listingID', 'memberID', 'listingHTML', 'listingStatus', 'listingDateTime', 'listingSlug', 'listingTitle'));
    $data = $Form->get_posted_content($Template, $Listings, $Listing);
    $data = array_merge($data, $fixed_fields);
    if ($Listing->listingStatus() != $data['listingStatus']) {
        // status has changed
        $Listing->set_status($data['listingStatus']);
    }
    $Listing->update($data);
    if (is_object($Listing)) {
コード例 #3
0
                         $mode = 'details';
                     } else {
                         if ($action == 'cancel_add') {
                             $mode = 'view';
                         } else {
                             if ($action == 'cancel_edit') {
                                 $mode = 'view';
                             }
                         }
                     }
                 }
             }
         }
     }
 }
 $objListings = Listings::Instance($listing_id);
 $listing_info_name = $objListings->GetField('business_name');
 // Start main content
 draw_title_bar(prepare_breadcrumbs(array(_MY_ACCOUNT => '', _MY_LISTINGS => '', $listing_info_name => '', _CATEGORIES => '', ucfirst($action) => '')), prepare_permanent_link('index.php?customer=my_listings', _BUTTON_BACK));
 //if($objSession->IsMessage('notice')) echo $objSession->GetMessage('notice');
 echo $msg;
 draw_content_start();
 if ($mode == 'view') {
     $objListingsCategories->DrawViewMode();
 } else {
     if ($mode == 'add') {
         $objListingsCategories->DrawAddMode();
     } else {
         if ($mode == 'edit') {
             $objListingsCategories->DrawEditMode($rid);
         } else {
コード例 #4
0
 public static function Init()
 {
     global $objLogin, $objSettings, $objSiteDescription;
     self::$params['page'] = isset($_GET['page']) ? prepare_input($_GET['page']) : 'home';
     self::$params['page_id'] = isset($_REQUEST['pid']) ? prepare_input_alphanumeric($_REQUEST['pid']) : 'home';
     self::$params['system_page'] = isset($_GET['system_page']) ? prepare_input($_GET['system_page']) : '';
     self::$params['type'] = isset($_GET['type']) ? prepare_input($_GET['type']) : '';
     self::$params['admin'] = isset($_GET['admin']) ? prepare_input($_GET['admin']) : '';
     self::$params['user'] = isset($_GET['user']) ? prepare_input($_GET['user']) : '';
     self::$params['customer'] = isset($_GET['customer']) ? prepare_input($_GET['customer']) : '';
     self::$params['patient'] = isset($_GET['patient']) ? prepare_input($_GET['patient']) : '';
     self::$params['doctor'] = isset($_GET['doctor']) ? prepare_input($_GET['doctor']) : '';
     self::$params['news_id'] = isset($_GET['nid']) ? (int) $_GET['nid'] : '';
     self::$params['album_code'] = isset($_GET['acode']) ? strip_tags(prepare_input($_GET['acode'])) : '';
     self::$params['search_in'] = isset($_POST['search_in']) ? prepare_input($_POST['search_in']) : '';
     if (self::$params['search_in'] == '') {
         if (self::$PROJECT == 'BusinessDirectory') {
             self::$params['search_in'] = 'listings';
         } else {
             if (self::$PROJECT == 'ShoppingCart') {
                 self::$params['search_in'] = 'products';
             } else {
                 if (self::$PROJECT == 'HotelSite') {
                     self::$params['search_in'] = 'rooms';
                 }
             }
         }
     }
     self::$params['lang'] = isset($_GET['lang']) ? prepare_input($_GET['lang']) : '';
     self::$params['currency'] = isset($_GET['currency']) ? prepare_input($_GET['currency']) : '';
     self::$params['token'] = isset($_GET['token']) ? prepare_input($_GET['token']) : '';
     self::$params['listing_id'] = isset($_GET['lid']) ? (int) $_GET['lid'] : '';
     self::$params['category_id'] = isset($_GET['cid']) ? (int) $_GET['cid'] : '';
     self::$params['manufacturer_id'] = isset($_GET['mid']) ? (int) $_GET['mid'] : '';
     self::$params['product_id'] = isset($_REQUEST['prodid']) ? (int) $_REQUEST['prodid'] : '';
     $req_preview = isset($_GET['preview']) ? prepare_input($_GET['preview']) : '';
     //------------------------------------------------------------------------------
     // check and set token
     $token = md5(uniqid(rand(), true));
     self::$params['token'] = $token;
     Session::Set('token', $token);
     //------------------------------------------------------------------------------
     // save last visited page
     if (self::$params['allow_last_visited'] && !$objLogin->IsLoggedIn()) {
         $condition = !empty(self::$params['page']) && self::$params['page'] != 'home';
         if (self::$PROJECT == 'HotelSite') {
             $condition = self::$params['page'] == 'booking' || self::$params['page'] == 'booking_details';
         } else {
             if (self::$PROJECT == 'ShoppingCart') {
                 $condition = self::$params['page'] == 'shopping_cart' || self::$params['page'] == 'checkout';
             } else {
                 if (self::$PROJECT == 'MedicalAppointment') {
                     $condition = self::$params['page'] == 'checkout_signin';
                 }
             }
         }
         if ($condition) {
             Session::Set('last_visited', 'index.php?page=' . self::$params['page']);
             if (self::$params['page'] == 'pages' && !empty(self::$params['page_id']) && self::$params['page_id'] != 'home') {
                 Session::Set('last_visited', Session::Get('last_visited') . '&pid=' . self::$params['page_id']);
             } else {
                 if (self::$params['page'] == 'news' && !empty(self::$params['news_id'])) {
                     Session::Set('last_visited', Session::Get('last_visited') . '&nid=' . self::$params['news_id']);
                 } else {
                     if (self::$params['page'] == 'listing' && !empty(self::$params['listing_id'])) {
                         Session::Set('last_visited', Session::Get('last_visited') . '&lid=' . self::$params['listing_id']);
                     } else {
                         if (self::$params['page'] == 'category' && !empty(self::$params['category_id'])) {
                             Session::Set('last_visited', Session::Get('last_visited') . '&cid=' . self::$params['category_id']);
                         } else {
                             if (self::$params['page'] == 'manufacturer' && !empty(self::$params['manufacturer_id'])) {
                                 Session::Set('last_visited', Session::Get('last_visited') . '&mid=' . self::$params['product_id']);
                             } else {
                                 if (self::$params['page'] == 'product' && !empty(self::$params['product_id'])) {
                                     Session::Set('last_visited', Session::Get('last_visited') . '&prodid=' . self::$params['product_id']);
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     //------------------------------------------------------------------------------
     // set language
     if ($objLogin->IsLoggedInAsAdmin()) {
         $pref_lang = $objLogin->GetPreferredLang();
         self::$params['lang'] = Languages::LanguageExists($pref_lang, false) ? $pref_lang : Languages::GetDefaultLang();
         $language_info = Languages::GetLanguageInfo(self::$params['lang']);
         self::$params['lang_dir'] = $language_info['lang_dir'];
         self::$params['lang_name'] = $language_info['lang_name'];
         self::$params['lang_name_en'] = $language_info['lang_name_en'];
         self::$params['lc_time_name'] = $language_info['lc_time_name'];
     } else {
         if (!$objLogin->IsLoggedIn() && (self::$params['admin'] == 'login' || self::$params['admin'] == 'password_forgotten')) {
             self::$params['lang'] = Languages::GetDefaultLang();
             $language_info = Languages::GetLanguageInfo(self::$params['lang']);
             self::$params['lang_dir'] = $language_info['lang_dir'];
             self::$params['lang_name'] = $language_info['lang_name'];
             self::$params['lang_name_en'] = $language_info['lang_name_en'];
             self::$params['lc_time_name'] = $language_info['lc_time_name'];
         } else {
             if (!empty(self::$params['lang']) && Languages::LanguageExists(self::$params['lang'])) {
                 //self::$params['lang']         = self::$params['lang'];
                 $language_info = Languages::GetLanguageInfo(self::$params['lang']);
                 Session::Set('lang', self::$params['lang']);
                 Session::Set('lang_dir', self::$params['lang_dir'] = $language_info['lang_dir']);
                 Session::Set('lang_name', self::$params['lang_name'] = $language_info['lang_name']);
                 Session::Set('lang_name_en', self::$params['lang_name_en'] = $language_info['lang_name_en']);
                 Session::Set('lc_time_name', self::$params['lc_time_name'] = $language_info['lc_time_name']);
             } else {
                 if (Session::Get('lang') != '' && Session::Get('lang_dir') != '' && Session::Get('lang_name') != '' && Session::Get('lang_name_en') != '') {
                     self::$params['lang'] = Session::Get('lang');
                     self::$params['lang_dir'] = Session::Get('lang_dir');
                     self::$params['lang_name'] = Session::Get('lang_name');
                     self::$params['lang_name_en'] = Session::Get('lang_name_en');
                     self::$params['lc_time_name'] = Session::Get('lc_time_name');
                 } else {
                     self::$params['lang'] = Languages::GetDefaultLang();
                     $language_info = Languages::GetLanguageInfo(self::$params['lang']);
                     self::$params['lang_dir'] = isset($language_info['lang_dir']) ? $language_info['lang_dir'] : '';
                     self::$params['lang_name'] = isset($language_info['lang_name']) ? $language_info['lang_name'] : '';
                     self::$params['lang_name_en'] = isset($language_info['lang_name_en']) ? $language_info['lang_name_en'] : '';
                     self::$params['lc_time_name'] = isset($language_info['lc_time_name']) ? $language_info['lc_time_name'] : '';
                 }
             }
         }
     }
     //------------------------------------------------------------------------------
     // set currency
     if (self::$PROJECT == 'ShoppingCart' || self::$PROJECT == 'HotelSite' || self::$PROJECT == 'BusinessDirectory' || self::$PROJECT == 'MedicalAppointment') {
         if (!empty(self::$params['currency']) && Currencies::CurrencyExists(self::$params['currency'])) {
             self::$params['currency_code'] = self::$params['currency'];
             $currency_info = Currencies::GetCurrencyInfo(self::$params['currency_code']);
             self::$params['currency_symbol'] = $currency_info['symbol'];
             self::$params['currency_rate'] = $currency_info['rate'];
             self::$params['currency_decimals'] = $currency_info['decimals'];
             self::$params['currency_symbol_place'] = $currency_info['symbol_placement'];
             Session::Set('currency_code', self::$params['currency']);
             Session::Set('currency_symbol', $currency_info['symbol']);
             Session::Set('currency_rate', $currency_info['rate']);
             Session::Set('currency_decimals', $currency_info['decimals']);
             Session::Set('symbol_placement', $currency_info['symbol_placement']);
         } else {
             if (Session::Get('currency_code') != '' && Session::Get('currency_symbol') != '' && Session::Get('currency_rate') != '' && Session::Get('currency_decimals') != '' && Session::Get('symbol_placement') != '' && Currencies::CurrencyExists(Session::Get('currency_code'))) {
                 self::$params['currency_code'] = Session::Get('currency_code');
                 self::$params['currency_symbol'] = Session::Get('currency_symbol');
                 self::$params['currency_rate'] = Session::Get('currency_rate');
                 self::$params['currency_decimals'] = Session::Get('currency_decimals');
                 self::$params['currency_symbol_place'] = Session::Get('symbol_placement');
             } else {
                 $currency_info = Currencies::GetDefaultCurrencyInfo();
                 self::$params['currency_code'] = $currency_info['code'];
                 self::$params['currency_symbol'] = $currency_info['symbol'];
                 self::$params['currency_rate'] = $currency_info['rate'];
                 self::$params['currency_decimals'] = $currency_info['decimals'];
                 self::$params['currency_symbol_place'] = $currency_info['symbol_placement'];
             }
         }
     }
     // preview allowed only for admins
     // -----------------------------------------------------------------------------
     if ($objLogin->IsLoggedInAsAdmin()) {
         if ($req_preview == 'yes' || $req_preview == 'no') {
             self::$params['preview'] = $req_preview;
             Session::Set('preview', self::$params['preview']);
         } else {
             if (self::$params['admin'] == '' && (Session::Get('preview') == 'yes' || Session::Get('preview') == 'no')) {
                 self::$params['preview'] = Session::Get('preview');
             } else {
                 self::$params['preview'] = 'no';
                 Session::Set('preview', self::$params['preview']);
             }
         }
     }
     // *** get site description
     // -----------------------------------------------------------------------------
     $objSiteDescription->LoadData(self::$params['lang']);
     // *** draw offline message
     // -----------------------------------------------------------------------------
     if ($objSettings->GetParameter('is_offline')) {
         if (!$objLogin->IsLoggedIn() && self::$params['admin'] != 'login') {
             $offline_content = @file_get_contents('html/site_offline.html');
             if (!empty($offline_content)) {
                 $offline_content = str_ireplace(array('{HEADER_TEXT}', '{SLOGAN_TEXT}', '{OFFLINE_MESSAGE}', '{FOOTER}'), array($objSiteDescription->GetParameter('header_text'), $objSiteDescription->GetParameter('slogan_text'), $objSettings->GetParameter('offline_message'), $objSiteDescription->DrawFooter(false)), $offline_content);
             } else {
                 $offline_content = $objSettings->GetParameter('offline_message');
             }
             echo $offline_content;
             exit;
         }
     }
     // *** draw offline message
     // -----------------------------------------------------------------------------
     if ($objSettings->GetParameter('is_offline')) {
         if (!$objLogin->IsLoggedIn() && self::$params['admin'] != 'login') {
             echo '<html>';
             echo '<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head>';
             echo '<body>' . $objSettings->GetParameter('offline_message') . '</body>';
             echo '</html>';
             exit;
         }
     }
     // *** run cron jobs file
     // -----------------------------------------------------------------------------
     if ($objSettings->GetParameter('cron_type') == 'non-batch') {
         include_once 'cron.php';
     }
     // *** default user page
     // -----------------------------------------------------------------------------
     if (self::$PROJECT == 'MicroCMS') {
         if ($objLogin->IsLoggedInAsUser()) {
             if (self::$params['user'] == '' && self::$params['page'] == '') {
                 self::$params['user'] = '******';
             }
         }
     } else {
         if (self::$PROJECT == 'BusinessDirectory') {
             if ($objLogin->IsLoggedInAsCustomer()) {
                 if (self::$params['customer'] == '' && self::$params['page'] == '') {
                     self::$params['customer'] = 'home';
                 }
             }
         } else {
             if (self::$PROJECT == 'ShoppingCart') {
                 if ($objLogin->IsLoggedInAsCustomer()) {
                     if (self::$params['customer'] == '' && self::$params['page'] == '') {
                         self::$params['customer'] = 'home';
                     }
                 }
             } else {
                 if (self::$PROJECT == 'HotelSite') {
                     if ($objLogin->IsLoggedInAsCustomer()) {
                         if (self::$params['customer'] == '' && self::$params['page'] == '') {
                             self::$params['customer'] = 'home';
                         }
                     }
                 } else {
                     if (self::$PROJECT == 'MedicalAppointment') {
                         if ($objLogin->IsLoggedInAsPatient()) {
                             if (self::$params['patient'] == '' && self::$params['page'] == '') {
                                 self::$params['patient'] = 'home';
                             }
                         }
                         if ($objLogin->IsLoggedInAsDoctor()) {
                             if (self::$params['doctor'] == '' && self::$params['page'] == '') {
                                 self::$params['doctor'] = 'home';
                             }
                         }
                     }
                 }
             }
         }
     }
     // *** get site template
     // -----------------------------------------------------------------------------
     self::$params['template'] = $objSettings->GetTemplate() != '' ? $objSettings->GetTemplate() : DEFAULT_TEMPLATE;
     if ($objLogin->IsLoggedInAsAdmin() && (self::$params['preview'] != 'yes' || self::$params['admin'] != '')) {
         self::$params['template'] = 'admin';
     } else {
         if (!$objLogin->IsLoggedIn() && (self::$params['admin'] == 'login' || self::$params['admin'] == 'password_forgotten')) {
             self::$params['template'] = 'admin';
         }
     }
     // *** use direction of selected language
     // -----------------------------------------------------------------------------
     self::$params['defined_left'] = self::$params['lang_dir'] == 'ltr' ? 'left' : 'right';
     self::$params['defined_right'] = self::$params['lang_dir'] == 'ltr' ? 'right' : 'left';
     self::$params['defined_alignment'] = self::$params['lang_dir'] == 'ltr' ? 'left' : 'right';
     // *** prepare META tags
     // -----------------------------------------------------------------------------
     if (self::$params['page'] == 'news' && self::$params['news_id'] != '') {
         $news_info = News::GetNewsInfo(self::$params['news_id'], self::$params['lang']);
         self::$params['tag_title'] = isset($news_info['header_text']) ? $news_info['header_text'] : $objSiteDescription->GetParameter('tag_title');
         self::$params['tag_keywords'] = isset($news_info['header_text']) ? str_replace(' ', ',', $news_info['header_text']) : $objSiteDescription->GetParameter('tag_keywords');
         self::$params['tag_description'] = isset($news_info['header_text']) ? $news_info['header_text'] : $objSiteDescription->GetParameter('tag_description');
     } else {
         if (self::$params['system_page'] != '') {
             $objPage = new Pages(self::$params['system_page'], true);
         } else {
             $objPage = new Pages(self::$params['page_id'], true);
         }
         self::$params['tag_title'] = $objPage->GetParameter('tag_title') != '' ? $objPage->GetParameter('tag_title') : $objSiteDescription->GetParameter('tag_title');
         self::$params['tag_keywords'] = $objPage->GetParameter('tag_keywords') != '' ? $objPage->GetParameter('tag_keywords') : $objSiteDescription->GetParameter('tag_keywords');
         self::$params['tag_description'] = $objPage->GetParameter('tag_description') != '' ? $objPage->GetParameter('tag_description') : $objSiteDescription->GetParameter('tag_description');
         if (self::$PROJECT == 'BusinessDirectory') {
             if (self::$params['page'] == 'category') {
                 $category_info = Categories::GetCategoryInfo(self::$params['category_id']);
                 self::$params['tag_title'] = isset($category_info['name']) ? strip_tags($category_info['name']) : '';
                 self::$params['tag_keywords'] = isset($category_info['name']) ? strip_tags($category_info['name']) : '';
                 self::$params['tag_description'] = isset($category_info['description']) ? strip_tags($category_info['description']) : '';
             } else {
                 if (self::$params['page'] == 'listing') {
                     $listing_info = Listings::GetListingInfo(self::$params['listing_id']);
                     self::$params['tag_title'] = isset($listing_info['business_name']) ? strip_tags($listing_info['business_name']) : '';
                     self::$params['tag_keywords'] = isset($listing_info['business_name']) ? trim(strip_tags($listing_info['business_name'])) : '';
                     self::$params['tag_description'] = isset($listing_info['business_address']) ? trim(strip_tags($listing_info['business_address'])) : self::$params['tag_title'];
                 }
             }
         }
     }
     // *** included js libraries
     // -----------------------------------------------------------------------------
     self::$params['js_included'] = array();
 }
コード例 #5
0
 public function receive_new_listing($SubmittedForm)
 {
     $API = new PerchAPI(1.0, 'perch_members');
     $Session = PerchMembers_Session::fetch();
     $input = $SubmittedForm->data;
     $data = array();
     $data['listingDateTime'] = date('Y-m-d H:i:s');
     $data['memberID'] = $Session->get('memberID');
     $data['listingType'] = $input['listingType'];
     $data['listingTitle'] = $input['listingTitle'];
     $data['listingSlug'] = PerchUtil::urlify($input['listingTitle']);
     foreach ($this->static_fields as $field) {
         if (!isset($data[$field])) {
             if (isset($input[$field]) && $input[$field] != '') {
                 $data[$field] = trim($input[$field]);
             }
         }
     }
     // dynamic fields
     $dynamic_fields = array();
     foreach ($input as $field => $val) {
         if (!isset($data[$field])) {
             $dynamic_fields[$field] = trim($val);
         }
     }
     $data['listingDynamicFields'] = PerchUtil::json_safe_encode($dynamic_fields);
     foreach ($data as $key => $val) {
         switch ($key) {
             case 'listingHTML':
                 if (!class_exists('\\Netcarver\\Textile\\Parser', false) && class_exists('Textile', true)) {
                     // sneaky autoloading hack
                 }
                 if (PERCH_HTML5) {
                     $Textile = new \Netcarver\Textile\Parser('html5');
                 } else {
                     $Textile = new \Netcarver\Textile\Parser();
                 }
                 if (PERCH_RWD) {
                     $val = $Textile->setDimensionlessImages(true)->textileRestricted($val);
                 } else {
                     $val = $Textile->textileRestricted($val);
                 }
                 if (defined('PERCH_XHTML_MARKUP') && PERCH_XHTML_MARKUP == false) {
                     $val = str_replace(' />', '>', $val);
                 }
                 break;
         }
         $data[$key] = $val;
     }
     // print_r($data);
     // die();
     if (isset($data['listingID'])) {
         if ($this->check_title_exists($data['listingTitle'], $data['listingID'])) {
             $Listings = new Listings($API);
             $Listing = $Listings->find($data['listingID']);
             // Don't allow people to change their URL
             unset($data['listingSlug']);
             $r = $Listing->update($data);
         } else {
             $SubmittedForm->throw_error('duplicate', 'listingTitle');
             return false;
         }
     } else {
         if ($this->check_title_exists($data['listingTitle'])) {
             $r = $this->create($data);
         } else {
             $SubmittedForm->throw_error('duplicate', 'listingTitle');
             return false;
         }
     }
     return $r;
     PerchUtil::debug('this' . $SubmittedForm);
 }
コード例 #6
0
ファイル: home.php プロジェクト: mozdial/Directory
        $actions_msg[] = _DEFAULT_OWN_EMAIL_ALERT;
    }
    if ($objLogin->IsLoggedInAs('owner', 'mainadmin') && Modules::IsModuleInstalled('contact_us')) {
        $admin_email_to = ModulesSettings::Get('contact_us', 'email');
        if ($admin_email_to == '' || preg_match('/yourdomain/i', $admin_email_to)) {
            $actions_msg[] = _CONTACTUS_DEFAULT_EMAIL_ALERT;
        }
    }
    if (Modules::IsModuleInstalled('comments')) {
        $comments_count = Comments::AwaitingModerationCount();
        if (ModulesSettings::Get('comments', 'comments_allow') == 'yes' && $comments_count > 0) {
            $actions_msg[] = str_replace('_COUNT_', $comments_count, _COMMENTS_AWAITING_MODERATION_ALERT);
        }
    }
    if (Modules::IsModuleInstalled('listings')) {
        $awaiting_listings = Listings::AwaitingModerationCount();
        if (ModulesSettings::Get('listings', 'pre_moderation_allow') == 'yes' && $awaiting_listings > 0) {
            $actions_msg[] = str_replace('_COUNT_', $awaiting_listings, _LISTINGS_AWAITING_MODERATION_ALERT);
        }
    }
    if (count($actions_msg) > 0) {
        if ($alert_state == '') {
            $msg = '<div id="divAlertRequired">
				<img src="images/close.png" alt="" style="cursor:pointer;float:' . Application::Get('defined_right') . ';margin-right:-3px;" title="' . _HIDE . '" onclick="javascript:appGoTo(\'admin=home\',\'&task=close_alert\')" />
				<img src="images/action_required.png" alt="" style="margin-bottom:-3px;" />&nbsp;&nbsp;<b>' . _ACTION_REQUIRED . '</b>: 
				<ul style="margin-top:7px;margin-bottom:7px;">';
            foreach ($actions_msg as $single_msg) {
                $msg .= '<li>' . $single_msg . '</li>';
            }
            $msg .= '</ul></div>';
            draw_important_message($msg, true, false);
コード例 #7
0
ファイル: Listings.class.php プロジェクト: mozdial/Directory
 /**
  *	Return instance of the class
  */
 public static function Instance($id = '')
 {
     if (self::$instance == null) {
         self::$instance = new Listings($id);
     }
     return self::$instance;
 }
コード例 #8
0
ファイル: listing.php プロジェクト: mozdial/Directory
<?php

/**
* @project ApPHP Business Directory
* @copyright (c) 2011 ApPHP
* @author ApPHP <*****@*****.**>
* @license http://www.gnu.org/licenses/
*/
// *** Make sure the file isn't accessed directly
defined('APPHP_EXEC') or die('Restricted Access');
//--------------------------------------------------------------------------
$objListing = Listings::Instance(Application::Get('listing_id'));
$objCategory = Categories::Instance();
$category_info = $objCategory->GetLevelsInfo($objListing->GetField('category_id'));
draw_title_bar(prepare_breadcrumbs(array(_CATEGORIES => prepare_link('categories', '', '', 'all', _SEE_ALL, '', '', true), $category_info['third']['name'] => $category_info['third']['link'], $category_info['second']['name'] => $category_info['second']['link'], $category_info['first']['name'] => $category_info['first']['link'])));
$objListing->DrawListing();
コード例 #9
0
ファイル: _subnav.php プロジェクト: amillionmonkeys/perchd
<?php

$Listing = new Listings($API);
$pending_comment_count = $Listing->get_count('PENDING');
echo $HTML->subnav($CurrentUser, array(array('page' => array('listing', 'listing/edit'), 'label' => 'Moderate', 'priv' => 'listing.moderate')));
コード例 #10
0
ファイル: Cron.class.php プロジェクト: mozdial/Directory
    /**
     * Run - called by outside cron
     */
    public static function Run()
    {
        // add here your code...
        // Class::Method();
        $perform_actions = false;
        // update last time running
        $sql = 'SELECT
					cron_type,
					cron_run_last_time,
					cron_run_period,
					cron_run_period_value,
					CASE
						WHEN cron_run_last_time = \'0000-00-00 00:00:00\' THEN \'999\'
						WHEN cron_run_period = \'minute\' THEN TIMESTAMPDIFF(MINUTE, cron_run_last_time, \'' . date('Y-m-d H:i:s') . '\')
						ELSE TIMESTAMPDIFF(HOUR, cron_run_last_time, \'' . date('Y-m-d H:i:s') . '\')
					END as time_diff										
				FROM ' . TABLE_SETTINGS;
        $result = database_query($sql, DATA_ONLY, FIRST_ROW_ONLY);
        if ($result['cron_type'] == 'batch') {
            $perform_actions = true;
        } else {
            if ($result['cron_type'] == 'non-batch' && $result['time_diff'] > $result['cron_run_period_value']) {
                $perform_actions = true;
            } else {
                $perform_actions = false;
            }
        }
        if ($perform_actions) {
            // update Feeds
            RSSFeed::UpdateFeeds();
            if (self::$PROJECT == 'ShoppingCart') {
                // close expired discount campaigns
                Campaigns::UpdateStatus();
                // remove expired orders
                Orders::RemoveExpired();
            } else {
                if (self::$PROJECT == 'HotelSite') {
                    // close expired discount campaigns
                    Campaigns::UpdateStatus();
                    // close expired coupons
                    Coupons::UpdateStatus();
                    // remove expired 'Preparing' bookings
                    Bookings::RemoveExpired();
                } else {
                    if (self::$PROJECT == 'BusinnessDirectory') {
                        // close expired lisitngs
                        Listings::UpdateStatus();
                        // remove old inquiries
                        Inquiries::RemoveOld();
                    } else {
                        if (self::$PROJECT == 'MedicalAppointment') {
                            // remove expired appointments
                            Appointments::RemoveExpired();
                            // send reminders for patient and doctor
                            Appointments::SendReminders();
                        } else {
                            if (self::$PROJECT == 'MicroBlog') {
                                // close expired polls
                                Pools::UpdateStatus();
                            }
                        }
                    }
                }
            }
            // update last time running
            $sql = 'UPDATE ' . TABLE_SETTINGS . ' SET cron_run_last_time = \'' . date('Y-m-d H:i:s') . '\'';
            database_void_query($sql);
        }
    }
コード例 #11
0
 /**
  * After-Insertion - add listing descriptions to description table
  */
 public function AfterInsertRecord()
 {
     global $objLogin;
     $category_id = isset($_POST['category_id']) ? (int) $_POST['category_id'] : '0';
     $objListings = Listings::Instance($this->listingId);
     $is_published = $objListings->GetField('is_published');
     $access_level = $objListings->GetField('access_level');
     if ($is_published == '1') {
         Categories::UpdateListingsCount($category_id, '+', $access_level);
     }
 }
コード例 #12
0
 public function allListings()
 {
     $listings = Listings::all();
     return view(testing . listingsList) . compact(listings);
 }
コード例 #13
0
ファイル: TemplatingManager.php プロジェクト: xinghao/shs
 /**
  * Get subscription info.
  * @param $listing_id
  * @return unknown_type
  */
 protected static function _setSubscriptionDataToView($listing_id, $view)
 {
     // Valid listing id.
     Listings::validateListingId($listing_id);
     // Get subscription of current lisitng.
     $subscription = new Subscription($listing_id);
     // If current lisitng does not have a subscription we jsut return.
     if (!$subscription->isSubscribed()) {
         return $view;
     }
     // Get general subscription info (lisitng_id, publisher_id etc)
     $subscriptionGeneral = $subscription->getGeneralSubscriptionInfoArray();
     if (!empty($subscriptionGeneral)) {
         foreach ($subscriptionGeneral as $key => $value) {
             $keyName = 'subscription_' . $key;
             $view->{$keyName} = $value;
             //echo $keyName . "\n";
         }
         // Change postgres timestamp format to ypex datetime format.
         $view->subscription_start_date = Common::getTimeByMonthDayYearHourMinute($view->subscription_start_date);
         $view->subscription_expiry_date = Common::getTimeByMonthDayYearHourMinute($view->subscription_expiry_date);
         // Get sales person name.
         $usersTable = new Users();
         $view->subscription_sales_person = $usersTable->getUserNamebyId($view->subscription_sales_person);
     }
     // Get price and product of current subscription.
     $priceAndProduct = $subscription->getPriceContractArray();
     if (!empty($priceAndProduct)) {
         foreach ($priceAndProduct as $key => $value) {
             $keyName = 'subscription_' . $key;
             $view->{$keyName} = $value;
             //echo $keyName . "\n";
         }
     }
     // Get last successful billing history
     $lastSuccessfulHistory = $subscription->getLastSuccessfulBillHistory();
     if (!empty($lastSuccessfulHistory)) {
         foreach ($lastSuccessfulHistory as $key => $value) {
             $keyName = 'subscription_successful_' . $key;
             $view->{$keyName} = $value;
             //echo $keyName . "\n";
         }
         // Change postgres timestamp format to ypex datetime format.
         $view->subscription_successful_payment_datetime = Common::getTimeByMonthDayYearHourMinute($view->subscription_successful_payment_datetime);
     }
     // Get Payment card info.
     $paymentCard = $subscription->getPaymentCardArrayWithHashedName();
     if (!empty($paymentCard)) {
         foreach ($paymentCard as $key => $value) {
             $keyName = 'subscription_' . $key;
             $view->{$keyName} = $value;
             //echo $keyName . "\n";
         }
     }
     return $view;
 }
コード例 #14
0
ファイル: runtime.php プロジェクト: amillionmonkeys/perchd
function listings_for_member($listingType, $opts = false, $return = false)
{
    $API = new PerchAPI(1.0, 'listing');
    $Session = PerchMembers_Session::fetch();
    $defaults = array();
    $defaults['template'] = 'listings_list.html';
    $defaults['count'] = false;
    $defaults['sort'] = 'listingDateTime';
    $defaults['sort-order'] = 'ASC';
    $defaults['paginate'] = false;
    $defaults['pagination-var'] = 'page';
    // $defaults['filter']          = 'filter';
    // $defaults['value']           = $Session->get('memberID');
    if (is_array($opts)) {
        $opts = array_merge($defaults, $opts);
    } else {
        $opts = $defaults;
    }
    $Listings = new Listings($API);
    $r = $Listings->get_custom($listingType, $opts);
    if ($return) {
        return $r;
    }
    echo $r;
}
コード例 #15
0
ファイル: list.pre.php プロジェクト: amillionmonkeys/perchd
<?php

$HTML = $API->get('HTML');
$Paging = $API->get('Paging');
$Paging->set_per_page(20);
$Listings = new Listings($API);
$Form = $API->get('Form');
if ($Form->posted() && $Form->validate()) {
    $listings = $Form->find_items('listing-', true);
    if (PerchUtil::count($listings)) {
        $status = $_POST['listingStatus'];
        foreach ($listings as $listingID) {
            $Listing = $Listings->find($listingID);
            $Listing->set_status($status);
        }
    }
}
$pending_listing_count = $Listings->get_count('PENDING');
$listings = array();
$status = 'pending';
if (isset($_GET['status']) && $_GET['status'] != '') {
    $status = $_GET['status'];
}
$listings = $Listings->get_by_status($status, $Paging);
if ($listings == false) {
    $Listings->attempt_install();
}
コード例 #16
0
ファイル: Menu.class.php プロジェクト: mozdial/Directory
 /**
  *	Draws menus 
  *		@param $menu_position
  *		@param $draw
  */
 public static function DrawMenu($menu_position = 'left', $draw = true)
 {
     global $objSettings, $objLogin;
     $output = '';
     if ($menu_position == 'left') {
         $objLogin->DrawLoginLinks();
     }
     // Get all menus which have items (links to pages)
     $menus = self::GetMenus($menu_position);
     $menus_count = $menus[1];
     $objNews = News::Instance();
     $show_news_block = ModulesSettings::Get('news', 'show_news_block');
     $show_subscribe_block = ModulesSettings::Get('news', 'show_newsletter_subscribe_block');
     if (Modules::IsModuleInstalled('news') && ($show_news_block == 'right side' || $show_subscribe_block == 'right side')) {
         $menus_count++;
     }
     $show_inquiries_block = ModulesSettings::Get('inquiries', 'show_inquiries_block');
     if (Modules::IsModuleInstalled('inquiries') && $show_inquiries_block == 'right side') {
         $menus_count++;
     }
     if (ModulesSettings::Get('listings', 'show_categories_side_block') == $menu_position . ' side') {
         $output .= Categories::DrawSideBlock(false);
         $menus_count++;
     }
     if (ModulesSettings::Get('listings', 'show_featured_block') == $menu_position . ' side') {
         $output .= Listings::DrawFeaturedBlock(false);
         $menus_count++;
     }
     if (ModulesSettings::Get('listings', 'show_recent_block') == $menu_position . ' side') {
         $output .= Listings::DrawRecentBlock(false);
         $menus_count++;
     }
     if (ModulesSettings::Get('listings', 'show_directory_statistics') == $menu_position . ' side') {
         $menus_count++;
     }
     if ($menus_count > 0) {
         $output .= '<div id="column-' . $menu_position . '-wrapper">';
     }
     // Display all menu titles (names) according to their order
     for ($menu_ind = 0; $menu_ind < $menus[1]; $menu_ind++) {
         // Start draw new menu
         $output .= draw_block_top($menus[0][$menu_ind]['menu_name'], '', 'maximazed', false);
         $menu_links = self::GetMenuLinks($menus[0][$menu_ind]['id'], Application::Get('lang'), $menu_position);
         if ($menu_links[1] > 0) {
             $output .= '<ul>';
         }
         for ($menu_link_ind = 0; $menu_link_ind < $menu_links[1]; $menu_link_ind++) {
             $class = Application::Get('page_id') == $menu_links[0][$menu_link_ind]['id'] ? ' active' : '';
             if ($menu_links[0][$menu_link_ind]['content_type'] == 'link') {
                 $output .= '<li>' . prepare_permanent_link($menu_links[0][$menu_link_ind]['link_url'], $menu_links[0][$menu_link_ind]['menu_link'], $menu_links[0][$menu_link_ind]['link_target'], 'main_menu_link' . $class) . '</li>';
             } else {
                 // draw current menu link
                 $output .= '<li>' . prepare_link('pages', 'pid', $menu_links[0][$menu_link_ind]['id'], $menu_links[0][$menu_link_ind]['page_key'], $menu_links[0][$menu_link_ind]['menu_link'], 'main_menu_link' . $class) . '</li>';
             }
         }
         if ($menu_links[1] > 0) {
             $output .= '</ul>';
         }
         $output .= draw_block_bottom(false);
     }
     if ($menu_position == 'left') {
         if (!$objLogin->IsLoggedIn() || Application::Get('preview') == 'yes') {
             if (Modules::IsModuleInstalled('customers') && ModulesSettings::Get('customers', 'allow_login') == 'yes') {
                 if (Application::Get('customer') != 'login') {
                     $output .= Customers::DrawLoginFormBlock(false);
                 }
             }
         }
         if (Modules::IsModuleInstalled('news')) {
             if ($show_news_block == 'left side') {
                 $output .= $objNews->DrawNewsBlock(false);
             }
             if ($show_subscribe_block == 'left side') {
                 $output .= $objNews->DrawSubscribeBlock(false);
             }
         }
         if (Modules::IsModuleInstalled('inquiries')) {
             if ($show_inquiries_block == 'left side') {
                 $output .= Inquiries::DrawLastInquiriesBlock(false);
             }
         }
     }
     if ($menu_position == 'right') {
         if (Modules::IsModuleInstalled('inquiries')) {
             if ($show_inquiries_block == 'right side') {
                 $output .= Inquiries::DrawLastInquiriesBlock(false);
             }
         }
         if (Modules::IsModuleInstalled('news')) {
             if ($show_news_block == 'right side') {
                 $output .= $objNews->DrawNewsBlock(false);
             }
             if ($show_subscribe_block == 'right side') {
                 $output .= $objNews->DrawSubscribeBlock(false);
             }
         }
     }
     if (ModulesSettings::Get('listings', 'show_directory_statistics') == $menu_position . ' side') {
         $output .= Listings::DrawDirectoryStatistics(false);
     }
     if ($menu_position == 'right') {
         if (Modules::IsModuleInstalled('adsense')) {
             $output .= '<div class="adsense-vertical">' . Adsense::GetVerticalBanerCode() . '</div>';
         }
     }
     if ($menus_count > 0) {
         $output .= '</div>';
     }
     $output .= '<br />';
     if ($draw) {
         echo $output;
     } else {
         return $output;
     }
 }
コード例 #17
0
ファイル: my_listings.php プロジェクト: mozdial/Directory
/**
* @project ApPHP Business Directory
* @copyright (c) 2011 ApPHP
* @author ApPHP <*****@*****.**>
* @license http://www.gnu.org/licenses/
*/
// *** Make sure the file isn't accessed directly
defined('APPHP_EXEC') or die('Restricted Access');
//--------------------------------------------------------------------------
if ($objLogin->IsLoggedInAsCustomer() && Modules::IsModuleInstalled('listings')) {
    $action = MicroGrid::GetParameter('action');
    $rid = MicroGrid::GetParameter('rid');
    $mode = 'view';
    $msg = '';
    $objListings = Listings::Instance();
    if ($action == 'add') {
        $mode = 'add';
    } else {
        if ($action == 'create') {
            if ($objListings->AddRecord()) {
                if (ModulesSettings::Get('listings', 'pre_moderation_allow') == 'yes') {
                    $msg = draw_success_message(_SUBMITTED_FOR_MODERATION, false);
                } else {
                    $msg = draw_success_message(_ADDING_OPERATION_COMPLETED, false);
                }
                $mode = 'view';
            } else {
                $msg = draw_important_message($objListings->error, false);
                $mode = 'add';
            }
コード例 #18
0
ファイル: index.php プロジェクト: mozdial/Directory
							\'' . date('Y-m-d H:i:s') . '\',
							0,
							1
						)
					';
                                                if (database_void_query($sql) > 0) {
                                                    $inquiry_id = mysql_insert_id();
                                                    if ($params['inquiry_type'] == '0') {
                                                        $where_clause = 'l.id IN (SELECT listing_id FROM ' . TABLE_LISTINGS_CATEGORIES . ' lc WHERE category_id = ' . (int) $params['inquiry_category'] . ') AND ';
                                                        $where_clause .= 'l.listing_location_id = ' . (int) $params['visitor_locations'] . ' AND ';
                                                        $where_clause .= 'l.listing_sub_location_id = ' . (int) $params['visitor_sub_locations'];
                                                    } else {
                                                        $where_clause = 'l.id = ' . (int) $params['listing_id'];
                                                    }
                                                    $sql_insert = '';
                                                    $arr_customers = Listings::GetCustomerInfoByListing($where_clause);
                                                    for ($i = 0; $i < $arr_customers[1]; $i++) {
                                                        $send_email = true;
                                                        // save inquires history (for standard inquires only)
                                                        if ($params['inquiry_type'] == '0') {
                                                            if ($arr_customers[0][$i]['inquiries_allowed'] == '-1' || $arr_customers[0][$i]['inquiries_sent'] < $arr_customers[0][$i]['inquiries_allowed']) {
                                                                $sql_insert .= $sql_insert == '' ? 'INSERT INTO ' . TABLE_INQUIRIES_HISTORY . '(inquiry_id, customer_id, listing_id, date_added) VALUES ' : ',';
                                                                $sql_insert .= '(' . (int) $inquiry_id . ', ' . (int) $arr_customers[0][$i]['customer_id'] . ', ' . (int) $params['listing_id'] . ', \'' . date('Y-m-d H:i:s') . '\')';
                                                            } else {
                                                                $send_email = false;
                                                            }
                                                        }
                                                        if ($send_email) {
                                                            send_email($arr_customers[0][$i]['email'], $objSettings->GetParameter('admin_email'), 'inquiry_new', array('{FIRST NAME}' => $arr_customers[0][$i]['first_name'], '{LAST NAME}' => $arr_customers[0][$i]['last_name'], '{WEB SITE}' => $_SERVER['SERVER_NAME'], '{BASE URL}' => APPHP_BASE));
                                                        }
                                                    }