if ($argv[1] == "--ufdbguard-status") {
        print_r(UFDBGUARD_STATUS());
        exit;
    }
    if ($argv[1] == "--persos") {
        PersonalCategoriesRepair();
        exit;
    }
}
include_once dirname(__FILE__) . '/framework/class.unix.inc';
if (!Build_pid_func(__FILE__, "MAIN")) {
    writelogs(basename(__FILE__) . ":Already executed.. aborting the process", basename(__FILE__), __FILE__, __LINE__);
    die;
}
if ($argv[1] == "--categories") {
    build_categories();
    exit;
}
if ($argv[2] == "--reload") {
    $GLOBALS["RELOAD"] = true;
}
if ($argv[1] == "--build") {
    build();
    exit;
}
if ($argv[1] == "--status") {
    echo status();
    exit;
}
if ($argv[1] == "--compile") {
    echo compile_databases();
    }
}
$rules_id = request_var('rules_id', '');
$uid = $bitfield = $options = '';
$allow_bbcode = $allow_smilies = $allow_urls = true;
$sql_ary = array('SELECT' => 'r.rules_id, r.rules_title, r.rules_text, r.display_rules, r.must_agree, r.display_as_link', 'FROM' => array(CLASSIFIEDS_RULES_TABLE => 'r'), 'WHERE' => 'r.rules_id = ' . $rules_id, 'ORDER_BY' => 'r.rules_id ASC');
if (!is_numeric($rules_id) || $rules_id > 3 || $rules_id < 1) {
    $sql_ary['WHERE'] = '';
}
$sql = $db->sql_build_query('SELECT', $sql_ary);
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
    generate_text_for_storage($row['rules_text'], $uid, $bitfield, $options, $allow_bbcode, $allow_urls, $allow_smilies);
    $row['rules_text'] = generate_text_for_display($row['rules_text'], $uid, $bitfield, $options);
    $template->assign_block_vars('rules', array('S_RULES_DISPLAY' => $row['display_rules'] && !empty($row['rules_text']) ? true : false, 'S_RULES_TITLE' => $row['rules_title'], 'S_RULES_TEXT' => $row['rules_text']));
}
$db->sql_freeresult($result);
if ($config['allow_classifieds_feeds']) {
    $feeds_mode = 'active';
    $template->assign_vars(array('L_CL_CLASSIFIEDS_RSS' => $user->lang('CL_CLASSIFIEDS_RSS', !empty($cat) ? $user->lang['CL_FOR_CAT'] . get_ad_category($cat) : $user->lang['CL_FOR_ALL_ACTIVE_ADS'])));
    $allow_feeds = true;
}
load_prefixes();
load_locations();
user_total_ads($user->data['user_id'], 'left_bar');
$template->assign_block_vars('navlinks', array('FORUM_NAME' => $user->lang['CL_CLASSIFIEDS'], 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}" . CL_DIRECTORY . "/index.{$phpEx}")));
$template->assign_block_vars('navlinks', array('FORUM_NAME' => empty($row['rules_title']) ? $user->lang['CL_RULES'] : $row['rules_title'], 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}" . CL_DIRECTORY . "/rules.{$phpEx}", "rules_id={$rules_id}")));
$template->assign_vars(array('S_IN_CLASSIFIEDS_RULES' => true, 'CATEGORIES' => build_categories(), 'U_VIEW_REPORTED_LINK' => $auth->acl_get('a_') || $auth->acl_get('m_report_classifieds') ? append_sid("{$phpbb_root_path}" . CL_DIRECTORY . "/index.{$phpEx}", 'mode=reported') : '', 'U_SEARCH_ADS' => append_sid("{$phpbb_root_path}" . CL_DIRECTORY . "/index.{$phpEx}", 'mode=search'), 'U_CLASSIFIEDS_RSS' => $allow_feeds ? append_sid("{$phpbb_root_path}" . CL_DIRECTORY . "/feeds.{$phpEx}", "mode={$feeds_mode}") : ''));
page_header($user->lang('CL_RULES'));
$template->set_filenames(array('body' => 'classifieds_rules_body.html'));
page_footer();
Example #3
0
	
	
}
	





include_once(dirname(__FILE__).'/framework/class.unix.inc');
if(!Build_pid_func(__FILE__,"MAIN")){
	writelogs(basename(__FILE__).":Already executed.. aborting the process",basename(__FILE__),__FILE__,__LINE__);
	die();
}

if($argv[1]=="--categories"){build_categories();exit;}
if($argv[2]=="--reload"){$GLOBALS["RELOAD"]=true;}
if($argv[1]=="--build"){build();exit;}
if($argv[1]=="--status"){echo status();exit;}
if($argv[1]=="--compile"){echo compile_databases();exit;}
if($argv[1]=="--db-status"){print_r(databasesStatus());exit;}
if($argv[1]=="--db-status-www"){echo serialize(databasesStatus());exit;}

if($argv[1]=="--compile-single"){echo CompileSingleDB($argv[2]);exit;}
if($argv[1]=="--conf"){echo conf();exit;}



//http://cri.univ-tlse1.fr/documentations/cache/squidguard.html

if ($auth->acl_get('u_edit_own_classifieds') && $user->data['user_id'] == $row['ad_poster_id'] || $auth->acl_get('a_') || $auth->acl_get('m_edit_classifieds')) {
    $edit_link = "{$phpbb_root_path}" . CL_DIRECTORY . "/manage_ad.{$phpEx}?mode=edit_ad&amp;ad_id=" . $ad_id;
} elseif ($auth->acl_get('m_move_classifieds')) {
    $edit_link = "{$phpbb_root_path}" . CL_DIRECTORY . "/manage_ad.{$phpEx}?mode=move_ad&amp;ad_id=" . $ad_id;
} else {
    $edit_link = false;
}
load_rules(2);
load_prefixes();
load_locations();
user_total_ads($row['user_id'], 'single_ad');
user_total_ads($user->data['user_id'], 'left_bar');
$template->assign_block_vars('navlinks', array('FORUM_NAME' => $user->lang['CL_CLASSIFIEDS'], 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}" . CL_DIRECTORY . "/index.{$phpEx}")));
$template->assign_block_vars('navlinks', array('FORUM_NAME' => censor_text($row['name']), 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}" . CL_DIRECTORY . "/index.{$phpEx}", "mode=cat&id=" . $row['cat_id'])));
$template->assign_block_vars('navlinks', array('FORUM_NAME' => censor_text($row['ad_title']), 'U_VIEW_FORUM' => append_sid($phpbb_root_path . CL_DIRECTORY . '/single_ad.' . $phpEx, 'ad_id=' . $ad_id)));
$template->assign_vars(array('S_IN_CLASSIFIEDS_SINGLE_AD' => true, 'S_BBCODE_ALLOWED' => true, 'S_ALLOWED_ADDTHIS_BUTTON' => $config['allow_addthis_button'], 'S_COMMENTS_ENABLED' => $config['allow_comments'], 'S_CUSTOM_FIELDS' => isset($cp_row['row']) && sizeof($cp_row['row']) ? true : false, 'S_ADVERTISERS_LEFT' => $config['advertisers_block_place'], 'S_DISPLAY_ADVERTISERS_BLOCK' => $config['display_advertisers_ads'], 'S_CAN_QUICK_AD' => $user->data['user_id'] == $row['ad_poster_id'] || $auth->acl_get('a_') ? true : false, 'CATEGORIES' => build_categories(), 'EXPIRATION_DATE' => $user->format_date($row['ad_expire']), 'AD_DESCRIPTION' => censor_text($description), 'LOCATION' => $row['location_name'] ? $row['location_name'] : $row['user_from'], 'EXPIRE_DATE' => $row['ad_expire'], 'NUM_POSTS' => $row['user_posts'], 'JOINED' => $user->format_date($row['user_regdate']), 'AD_TITLE' => censor_text($row['ad_title']), 'AD_PRICE' => $row['ad_price_text'] == 0 ? str_replace('.00', '', $row['ad_price']) : $user->lang['CL_BY_AGREEMENT'], 'PAYPAL_PRICE' => $row['ad_price_text'] == 0 ? str_replace('.00', '', $row['ad_price']) : '', 'CAT_NAME' => $row['name'], 'AD_DATE' => $user->format_date($row['ad_date']), 'AD_POSTER' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']), 'AD_STATUS' => $row['ad_status'], 'AD_STATUS_TEXT' => $ad_status, 'USER_AIM' => $row['user_aim'], 'USER_MSN' => $row['user_msnm'], 'USER_YIM' => $row['user_yim'], 'USER_JABBER' => $row['user_jabber'], 'PHONE' => $row['phone'], 'PAYPAL' => $row['paypal'], 'AD_CURRENCY' => $row['paypal_currency'], 'AD_PREFIX' => $row['prefix_short'], 'AD_PREFIX_COLOR' => $row['prefix_color'], 'LAST_EDIT' => $row['edit_time'] ? sprintf($user->lang['CL_AD_LAST_EDIT'], $user->format_date($row['edit_time']), $row['last_edit_by']) : '', 'S_SHOW_SMILEY_LINK' => true, 'U_MORE_SMILIES' => append_sid("{$phpbb_root_path}posting.{$phpEx}", 'mode=smilies'), 'S_SMILIES_ALLOWED' => true, 'S_BBCODE_ALLOWED' => true, 'S_BBCODE_IMG' => true, 'S_LINKS_ALLOWED' => true, 'S_BBCODE_QUOTE' => true, 'U_VIEW_REPORTED_LINK' => $auth->acl_get('a_') || $auth->acl_get('m_report_classifieds') ? append_sid("{$phpbb_root_path}" . CL_DIRECTORY . "/index.{$phpEx}", 'mode=reported') : '', 'U_SEARCH_ADS' => append_sid("{$phpbb_root_path}" . CL_DIRECTORY . "/index.{$phpEx}", 'mode=search'), 'U_AD_ACTION' => append_sid("{$phpbb_root_path}" . CL_DIRECTORY . "/single_ad.{$phpEx}", "ad_id={$ad_id}"), 'U_COMMENT' => append_sid("{$phpbb_root_path}" . CL_DIRECTORY . "/includes/class_comment.{$phpEx}", "mode=new_comment&amp;ad_id=" . $ad_id), 'U_CLOSE_REPORT' => $row['reported'] && ($auth->acl_get('a_') || $auth->acl_get('m_report_classifieds')) ? append_sid("{$phpbb_root_path}" . CL_DIRECTORY . "/manage_ad.{$phpEx}", 'mode=close_report&amp;ad_id=' . $ad_id) : '', 'U_DELETE_LINK' => $auth->acl_get('u_can_delete_classifieds') && $user->data['user_id'] == $row['ad_poster_id'] || $auth->acl_get('a_') || $auth->acl_get('m_delete_classifieds') ? append_sid("{$phpbb_root_path}" . CL_DIRECTORY . "/manage_ad.{$phpEx}", 'mode=delete_ad&amp;ad_id=' . $ad_id) : '', 'U_EXTEND_LINK' => ($auth->acl_get('m_extend_classifieds') || $auth->acl_get('u_can_extend_classifieds') && $user->data['user_id'] == $row['ad_poster_id'] || $auth->acl_get('a_')) && $row['ad_expire'] < time() ? append_sid($phpbb_root_path . CL_DIRECTORY . '/manage_ad.' . $phpEx, 'mode=extend_ad&amp;ad_id=' . intval($ad_id)) : '', 'U_EDIT_LINK' => $edit_link ? append_sid($edit_link) : '', 'U_REPORT_LINK' => $auth->acl_get('u_can_report_classifieds') ? append_sid("{$phpbb_root_path}" . CL_DIRECTORY . "/manage_ad.{$phpEx}", 'mode=report_ad&amp;ad_id=' . $ad_id) : '', 'U_PM' => $config['allow_privmsg'] && $auth->acl_get('u_sendpm') && ($row['user_allow_pm'] || $auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_')) ? append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'i=pm&amp;mode=compose&amp;u=' . $row['user_id']) : '', 'U_AIM' => $row['user_aim'] && $auth->acl_get('u_sendim') ? append_sid("{$phpbb_root_path}memberlist.{$phpEx}", 'mode=contact&amp;action=aim&amp;u=' . $row['user_id']) : '', 'U_EMAIL' => !empty($row['user_allow_viewemail']) && $auth->acl_get('u_sendemail') || $auth->acl_get('a_user') ? $config['board_email_form'] && $config['email_enable'] ? append_sid("{$phpbb_root_path}memberlist.{$phpEx}", 'mode=email&amp;u=' . $row['user_id']) : ($config['board_hide_emails'] && !$auth->acl_get('a_user') ? '' : 'mailto:' . $row['user_email']) : '', 'U_MSN' => $row['user_msnm'] && $auth->acl_get('u_sendim') ? append_sid("{$phpbb_root_path}memberlist.{$phpEx}", 'mode=contact&amp;action=msnm&amp;u=' . $row['user_id']) : '', 'U_YIM' => $row['user_yim'] ? 'http://edit.yahoo.com/config/send_webmesg?.target=' . urlencode($row['user_yim']) . '&amp;.src=pg' : '', 'U_JABBER' => $row['user_jabber'] && $auth->acl_get('u_sendim') ? append_sid("{$phpbb_root_path}memberlist.{$phpEx}", 'mode=contact&amp;action=jabber&amp;u=' . $row['user_id']) : ''));
// Select images
$sql = 'SELECT image_name
					FROM  ' . CLASSIFIEDS_IMAGES_TABLE . '
					WHERE ad_id = ' . $ad_id;
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
    $template->assign_block_vars('images', array('SOURCE' => generate_board_url() . '/' . CL_DIRECTORY . '/images/' . $row['image_name'], 'THUMB_SOURCE' => generate_board_url() . '/' . CL_DIRECTORY . '/images/thumb/' . $row['image_name']));
}
$db->sql_freeresult($result);
if (!empty($cp_row['blockrow'])) {
    foreach ($cp_row['blockrow'] as $field_data) {
        $template->assign_block_vars('custom_fields', $field_data);
    }
}
if ($config['allow_comments']) {
}
// Random ads block
if ($config['display_rand_miniblock'] && $config['rand_miniblock_num_ads'] != 0) {
    display_random_ads($config['rand_miniblock_num_ads']);
}
// Hot ads block
if ($config['display_hot_ads'] && $config['hot_ads_num'] != 0) {
    display_hot_ads($config['hot_ads_num']);
}
load_rules(1);
load_prefixes();
load_locations();
user_total_ads($user->data['user_id'], 'left_bar');
$template->assign_block_vars('navlinks', array('FORUM_NAME' => $user->lang['CL_CLASSIFIEDS'], 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}" . CL_DIRECTORY . "/index.{$phpEx}")));
$template->assign_block_vars('navlinks', array('FORUM_NAME' => $classifieds_title, 'U_VIEW_FORUM' => $pagination_url));
$template->assign_vars(array('S_IN_CLASSIFIEDS_INDEX' => true, 'S_WATCHING_CAT' => $watching_cat, 'S_RANDOM_LEFT' => $config['rand_miniblock_place'], 'S_DISPLAY_RANDOM_BLOCK' => $config['display_rand_miniblock'], 'S_HOT_LEFT' => $config['hot_block_place'], 'S_DISPLAY_HOT_BLOCK' => $config['display_hot_ads'], 'S_CLOSED_COLOR' => $config['closed_color'], 'S_SOLD_COLOR' => $config['sold_color'], 'RANDOM_BLOCK_WIDTH' => $config['rand_miniblock_num_ads'] != 0 ? floor(100 / $config['rand_miniblock_num_ads']) : '', 'HOT_BLOCK_WIDTH' => $config['hot_ads_num'] != 0 ? floor(100 / $config['hot_ads_num']) : '', 'CATEGORIES' => build_categories(), 'CLASSIFIEDS_TITLE' => $classifieds_title, 'L_CL_CLASSIFIEDS_RSS' => $user->lang('CL_CLASSIFIEDS_RSS', !empty($cat) ? $user->lang['CL_FOR_CAT'] . $classifieds_title : $user->lang['CL_FOR_ALL_ACTIVE_ADS']), 'U_VIEW_REPORTED_LINK' => $auth->acl_get('a_') || $auth->acl_get('m_report_classifieds') ? append_sid("{$phpbb_root_path}" . CL_DIRECTORY . "/index.{$phpEx}", 'mode=reported') : '', 'U_NEW_AD' => $auth->acl_get('u_post_classifieds') ? append_sid("{$phpbb_root_path}" . CL_DIRECTORY . "/manage_ad.{$phpEx}", 'mode=create_ad') : '', 'U_SEARCH_ADS' => append_sid("{$phpbb_root_path}" . CL_DIRECTORY . "/index.{$phpEx}", "mode=search"), 'U_WATCH_CAT' => $can_watch_cat ? append_sid("{$phpbb_root_path}" . CL_DIRECTORY . "/index.{$phpEx}", 'id=' . $cat . '&amp;subscribe=1') : '', 'U_CLASSIFIEDS_RSS' => $config['allow_classifieds_feeds'] ? append_sid("{$phpbb_root_path}" . CL_DIRECTORY . "/feeds.{$phpEx}", "mode={$feeds_mode}") : '', 'REPORTED_IMG' => $user->img('icon_topic_reported', 'TOPIC_REPORTED')));
if ($now > $config['last_check_expired'] + 3600) {
    // Select all Active but Expired ads and sent emails to their owners
    $sql = 'SELECT a.ad_expire, a.ad_id, a.ad_title, a.ad_date, a.ad_price, a.ad_price_text, u.user_id, u.username, u.user_lang, u.user_email, u.user_jabber, u.user_notify_type
  					FROM  ' . USERS_TABLE . ' u, ' . CLASSIFIEDS_TABLE . ' a
  					WHERE u.user_id = a.ad_poster_id
  						AND ' . $now . ' > a.ad_expire
  						AND (a.expire_email = 0 OR a.expire_email = "")
  						AND a.ad_status = ' . ACTIVE;
    $result = $db->sql_query($sql);
    while ($row = $db->sql_fetchrow($result)) {
        if ($config['email_expire']) {
            if ($row['ad_price_text'] == 1) {
                $row['ad_price'] = $user->lang['CL_BY_AGREEMENT'];
            } else {
                $row['ad_price'] = str_replace('.00', '', $row['ad_price']);