public function payment() { if (!Session::get('order.schedule')) { return Redirect::route('order.schedule'); } $data = ['title' => __FUNCTION__, 'list_cities' => getCities(), 'form_data' => Session::get('order.payment')]; return View::make('order.payment', $data); }
function crawl($tname, $year, $monthArr) { $dealType = $GLOBALS['dealType']; $stateArr = $GLOBALS['stateArr']; if ($monthArr == null) { die("monthArr must be set!"); } $period = intval(($monthArr[0] - 1) / 3) + 1; echo "Working on {$year} ({$period}) " . implode(" ", $monthArr) . "\n"; $db = new mysqli("p:localhost", "trend", "only!trend!", "rtrend"); // Check connection if ($db->connect_error) { die("Connection failed: " . $db->connect_error); } // Set utf8 //$db->set_charset("utf8"); if (!isset($dealType[$tname])) { die("No args for {$tname}\n"); } // get deal type and table name $args = $dealType[$tname]; foreach ($stateArr as $state => $stateCode) { echo "Working on {$year} ({$period}) on {$state} for {$tname}\n"; $cities = getCities($year, $period, $stateCode, $args); $cityArr = json_decode($cities, true); foreach ($cityArr['jsonList'] as $city) { $counties = getCounties($year, $period, $stateCode, $city['CODE'], $args); $countyArr = json_decode($counties, true); foreach ($countyArr['jsonList'] as $county) { $deals = getDeals($year, $period, $stateCode, $city['CODE'], $county['CODE'], $args); $dealArr = json_decode($deals, true); foreach ($monthArr as $month) { // echo("Working on $year/$month ($period) on $state " . $city['NAME'] . " " . $county['NAME'] . "\n"); $infoArr = ['year' => $year, 'month' => $month, 'state' => $state, 'city' => $city['NAME'], 'county' => $county['NAME']]; // update // function update($db, $tname, $metaArr, $json) { update($db, $tname, $infoArr, $deals); } } } } // make aggregation foreach ($monthArr as $month) { echo "Make agg {$tname} on {$year}/{$month}"; mkagg($db, $tname, $year, $month); } $db->close(); }
function index() { $allUrls = array(); $otherPages = array("classified/search", "contactus", "contactus-m", "about", "how-to-use", "terms-and-condition", "privacy-policy", "about-m", "how-to-use-m", "terms-and-condition-m", "privacy-policy-m"); foreach ($otherPages as $page) { $crDate = date("Y-m-d", strtotime('-3 day')); $allUrls[] = array("loc" => $page, "priority" => "0.8", "lastmod" => $crDate); } $categories = $this->common_model->getCategoryArray(); $cities = getCities(); foreach ($categories as $cat) { foreach ($cities as $city) { $allUrls[] = array("loc" => "search/" . $cat['cat_slug'] . "/" . urlencode($city->city_name), "priority" => "0.8", "lastmod" => $crDate); } } /* $categories = $this->common_model->getCategoryOrderedArray(); foreach ($categories as $category) { $crDate = date("Y-m-d",strtotime('-1 day')); $allUrls[] = array("loc"=>createUrl("category",array($category['category']['cat_id'],$category['category']['cat_name'])),"priority"=>"0.8","lastmod"=>$crDate); if (isset($category["children"])) { foreach ($category["children"] as $cat) { $allUrls[] = array("loc"=>"classified/search?category=".urlencode($category['category']['cat_id']."-".@$cat['category']['cat_id']."-"),"priority"=>"0.8","lastmod"=>$crDate); } } }*/ $classifieds = $this->common_model->selectData(CLASSIFIEDAD, "clad_id,clad_title,clad_modified_date", array("clad_active" => 1, "clad_expiry_date >=" => date('Y-m-d H:i:s')), "clad_modified_date", "DESC"); foreach ($classifieds as $classified) { $time = date("Y-m-d", strtotime($classified->clad_modified_date)); $crDate = $time; $allUrls[] = array("loc" => createUrl("detail", array($classified->clad_id, $classified->clad_title)), "priority" => "0.8", "lastmod" => $crDate); } $data['urls'] = $allUrls; header("Content-Type: text/xml;charset=iso-8859-1"); $this->load->view("sitemap", $data); }
<?php } else { ?> <error>invalid id specified</error> <?php } } function checkValid($id) { global $location; $table = 'wp_blogs'; $query = 'SELECT * FROM ' . $table . ' WHERE blog_id = ' . $id . ' ORDER BY blog_name ASC'; $result = mysql_query($query); if ($row = mysql_fetch_array($result)) { return $row['domain']; } else { return false; } } if ($type == "cities") { getCities(); } elseif ($type == "topics") { getTopics(); } elseif ($type == 'categories') { getCategoriesForID($id); } else { echo "<error>incorrect type specified</error>"; }
/** * Include helpers */ include_once app_path('helpers.php'); Route::get('/tes', function () { $order = \User::with('city')->find(1); // return $order; $data = ['user' => $order]; return View::make('emails.admin-new-user', $data); }); /** * Register view composer */ View::composer(array('partial.modal'), function ($view) { $view->with('list_cities', getCities()); }); View::composer(array('user._side'), function ($view) { $view->with('space_credit', app('UserRepo')->getCustomerSpaceCredit()); }); Route::get('/', ['as' => 'page.index', 'uses' => 'PageController@index']); /* Page that Require Authentication */ Route::group(['before' => 'auth'], function () { Route::get('/dashboard', ['as' => 'user.dashboard', 'uses' => 'UserController@dashboard']); Route::get('/member-list', ['as' => 'user.member_list', 'uses' => 'UserController@memberList']); Route::get('/add-member', ['as' => 'user.member_add', 'uses' => 'UserController@memberAdd']); Route::post('/add-member', ['as' => 'user.member_add.post', 'uses' => 'UserController@memberAddPost']); Route::get('/edit-member/{num}', ['as' => 'user.member_edit', 'uses' => 'UserController@memberEdit']); Route::put('/edit-member/{num}', ['as' => 'user.member_edit.put', 'uses' => 'UserController@memberEditPut']); Route::get('/delete-member/{num}', ['as' => 'user.member_delete', 'uses' => 'UserController@memberDelete']); Route::post('/set-stored', ['as' => 'user.delivery.stored', 'uses' => 'UserController@setDeliveryStored']);
/** * show modal form return schedule * @return View */ public function modalStorageReturn($id) { $storage = app('UserRepo')->getStorageDetail($id); $cities = getCities(); $data = ['storage' => $storage, 'list_cities' => $cities, 'modal_title' => 'Return Schedule Order : #' . $storage['order_payment']['code']]; return View::make('modal.storage_return', $data); }
public function edit($id) { if ($id == "" || $id <= 0) { redirect('admin/classifiedad'); } $where = 'clad_id = ' . $id; $this->common_model->updateData(CLASSIFIEDAD, array('is_readed' => 1, 'clad_modified_date' => date('Y-m-d H:i:s')), $where); $post = $this->input->post(); //pr($post,9); if ($post) { $error = array(); $e_flag = 0; /*update deal id to uploaded image link*/ $newimages = array_filter(explode(",", $post['newimages'])); foreach ($newimages as $img) { if (strpos($img, "tmp") !== false) { $from = './uploads/ad/' . $img; $to = './uploads/ad/' . str_replace("tmp/", "", $img); rename($from, $to); } $imgArray[] = str_replace("tmp/", "", $img); } $newimages = implode(",", $imgArray); if ($e_flag == 0) { $data = array('clad_title' => $post['clad_title'], 'clad_description' => $post['clad_description'], 'clad_image' => $newimages, 'clad_category' => $post['clad_category'], 'clad_price' => $post['clad_price'], 'clad_city' => $post['clad_city'], 'clad_locality' => $post['clad_locality'], 'clad_modified_date' => date('Y-m-d H:i:s'), 'clad_active' => isset($post['clad_active']) ? 1 : 0, 'is_readed' => 1, 'clad_is_premium' => isset($post['clad_is_premium']) ? 1 : 0, 'clad_remark' => $post['clad_remark']); foreach ($this->otherFields as $key => $value) { if (isset($post[$key])) { $data[$key] = $post[$key]; } } $ret_deal = $this->common_model->updateData(CLASSIFIEDAD, $data, $where); if ($ret_deal > 0) { ## send mail n sms to owner $uData = $this->common_model->selectData(USER, '*', array("u_id" => $post['clad_uid'])); $uName = $uData[0]->u_fname ? $uData[0]->u_fname : ''; $uEmail = $uData[0]->u_email ? $uData[0]->u_email : ''; if ($uEmail != '') { $emailTpl = $this->load->view('email_templates/adupdatenotification', array('name' => $uName, 'adtitle' => $post['clad_title'], 'adid' => $id, 'adUrl' => createUrl("detail", array(@$id, @$post['clad_title']))), true); $retemail = sendEmail($uEmail, SUBJECT_ADDUPDATE_INFO, $emailTpl, FROM_EMAIL, FROM_NAME); } ## Send sms to seller $phonemsg = ADUPDATE_MSG_NOTIFICATION; ## take msg content from constant $phonemsg = str_replace('{name}', $cnt, $phonemsg); $phonemsg = str_replace('{clad_id}', "#" . $id, $phonemsg); $phonemsg = str_replace('{clad_title}', $post['clad_title'], $phonemsg); $response = connectMobile($phonemsg, $phoneNumber); $res = json_decode($response->raw_body, true); $flash_arr = array('flash_type' => 'success', 'flash_msg' => 'Classified ad updated successfully.'); } else { $flash_arr = array('flash_type' => 'error', 'flash_msg' => 'An error occurred while processing.'); } $this->session->set_flashdata($flash_arr); redirect("admin/classifiedad"); } $data['error_msg'] = $error; } $classified = $this->common_model->selectData(CLASSIFIEDAD, '*', $where); $data['classified'] = $classified[0]; $data['customer'] = $this->common_model->customerTitleById($classified[0]->clad_uid); if (empty($classified)) { redirect('admin/classfied'); } $data['cityArr'] = getCities(); $data['view'] = "add_edit"; $data['categories'] = $this->common_model->getCategoryOrderedArray(); $data['otherFields'] = $this->otherFields; $data['id'] = $id; $this->load->view('admin/content', $data); }
public function newadd1() { //$p_categories = $this->common_model->getCategoryOrderedArray(); $data['p_categories'] = $p_categories; $data['view'] = "newadd1"; $data['nosearchbar'] = false; if ($this->user_session['uid'] != '') { $uArr = $this->common_model->selectData(USER, '*', array("u_id" => $this->user_session['uid'])); $data['uArr'] = (array) $uArr[0]; } else { $data['uArr'] = array(); } $data['categories'] = $this->common_model->getCategoryOrderedArray(true); $data['otherFields'] = $this->otherFields; $data['cityArr'] = getCities(); $this->load->view('content', $data); }
*/ if (!defined('hcAdmin')) { header("HTTP/1.1 403 No Direct Access"); exit; } include HCLANG . '/admin/tools.php'; appInstructions(0, "Filter_Link", $hc_lang_tools['TitleFilter'], $hc_lang_tools['InstructFilter']); echo ' <form name="frmToolLink" id="frmToolLink" method="post" action="" onsubmit="return false;"> <fieldset> <legend>' . $hc_lang_tools['Link'] . '</legend> <input name="filterLink" id="filterLink" type="text" size="95" maxlength="200" value="' . CalRoot . '/link.php" /> </fieldset> <fieldset> <legend>' . $hc_lang_tools['Cities'] . '</legend>'; $cities = getCities(); $cnt = 1; $columns = 3; $colWidth = number_format(100 / $columns, 0); $colLimit = ceil(count($cities) / $columns); echo ' <div class="catCol">'; foreach ($cities as $val) { if ($cnt > $colLimit) { echo $cnt > 1 ? ' </div>' : ''; echo ' <div class="catCol">'; $cnt = 1; } echo $val != '' ? '
public function userAdEdit($id) { //echo $id;die; $session = $this->session->userdata('user_session'); #pr($session,1); if (!isset($session['uid'])) { redirect(base_url()); } $uid = $this->user_session['uid']; $post = $this->input->post(); $adArr = $this->common_model->selectData(CLASSIFIEDAD, '*', array("clad_id" => $id), 'clad_modified_date', 'desc'); $data['resArr'] = $prevImgArr = (array) $adArr[0]; if ($post) { //pr($post,8); $this->load->library('form_validation'); $this->form_validation->set_rules('category', 'Category', 'trim|required'); $this->form_validation->set_rules('heading', 'Heading', 'trim|required'); $this->form_validation->set_rules('price', 'Price', 'trim|required'); $this->form_validation->set_rules('textcomment', 'Comment', 'trim|required'); if ($this->form_validation->run() !== false) { $curDate = date('Y-m-d H:i:s'); $where = 'clad_id = ' . $id; //pr($post,8); ## check for blocked word $cladtitle = trim($post['heading']); $claddesc = trim($post['textcomment']); $this->load->library('user_agent'); $blockedWordArr = getBlockedWords(); $searchTitleArr = explode(' ', $cladtitle); $searchDescArr = explode(' ', $claddesc); //pr($blockedWordArr,8); foreach ($blockedWordArr as $token) { //if (strpos($cladtitle, $token) !== FALSE) { if (in_array($token, $searchTitleArr)) { $flash_arr = array('flash_type' => 'error', 'flash_msg' => 'Your Ad Title contains some bad words which is not accepted in our system.'); $this->session->set_flashdata($flash_arr); redirect($this->agent->referrer()); } //if (strpos($claddesc, $token) !== FALSE) { if (in_array($token, $searchDescArr)) { $flash_arr = array('flash_type' => 'error', 'flash_msg' => 'Your Ad Description contains some bad words which is not accepted in our system.'); $this->session->set_flashdata($flash_arr); redirect($this->agent->referrer()); } } //echo $previmgstr = $prevImgArr['clad_image']; //$files = processAdImages($_FILES); //$previmgstr = $prevImgArr['clad_image']; $newimagesArr = array(); /** Old popup based image upload code :Mitesh $newimages = array_filter(explode(",",$post['newimages'])); foreach ($newimages as $img) $imgArray[]=str_replace("tmp/","",$img); $newimagesArr = implode(",",$imgArray);*/ $resimg = array(); $prevImgArr['clad_image'] = trim($prevImgArr['clad_image'], ','); $prevImgArr = explode(',', $prevImgArr['clad_image']); //$newimages = array_filter(explode(",",$post['newimagesid'])); $newimagesArr = $post['newimagesid']; $unlinkimgarr = array(); $ij = 1; //$curoldimg = explode('||',$post['newimagesid']); //$curoldimg = explode(',',$curoldimg[1]); $newimagesArr = trim($newimagesArr, ','); $curoldimg = explode(',', $newimagesArr); foreach ($prevImgArr as $k => $v) { if (!in_array($v, $curoldimg)) { $unlinkimgarr[] = $v; unset($prevImgArr[$k]); } } //pr($unlinkimgarr,9); ##get first image to set mainimage /*if(isset($post['firstimage']) && $post['firstimage']!='') { $xArr = explode("||",$post['firstimage']); $firstimage = ''; if($xArr[1] != "") $firstimage = $xArr[1]; }*/ /*foreach($newimages as $img) { $imgdata = $post[$img]; if($imgdata!='') { $resimg[] = $retval = base64_to_jpeg($imgdata,$ij); //if($firstimage == '' && $xArr[0]==$img) // $firstimage = $retval; //if(isset($prevImgArr[$ij-1]) && $prevImgArr[$ij-1] != '') //$unlinkimgarr[] = $prevImgArr[$ij-1]; } else { if(isset($prevImgArr[$ij-1]) && $prevImgArr[$ij-1] != '') $resimg[] = $prevImgArr[$ij-1]; } $ij++; } $imgArray=array(); foreach ($resimg as $img) $imgArray[]=str_replace("uploads/ad/tmp/","",$img); $firstimage = str_replace("uploads/ad/tmp/","",$firstimage); $imgArray = array_diff($imgArray, array($firstimage)); array_unshift($imgArray,$firstimage); $newimagesArr = implode(",",$imgArray);*/ //pr($unlinkimgarr); //pr($newimagesArr); //pr($resimg,9); $param = array('clad_title' => $post['heading'], 'clad_price' => $post['price'], 'clad_category' => trim($post['clad_category']), 'clad_description' => $post['textcomment'], 'clad_city' => trim($post['city']), 'clad_image' => $newimagesArr, 'clad_modified_date' => $curDate); if (isset($post['locality']) && $post['locality'] != '') { $param['clad_locality'] = trim($post['locality']); } /*if(!empty($files['images']['name'])) { $param['clad_image']=implode(',', array_filter($files['images']['name'])); if(isset($_POST['images']) && !empty($_POST['images'])) { foreach($_POST['images'] as $k=>$v) { if(isset($_FILES['images']['name'][$k]) && $_FILES['images']['name'][$k] != '') { if(file_exists(DOC_ROOT_CLASSIFIED_AD.$v)) unlink(DOC_ROOT_CLASSIFIED_AD.$v); unset($_POST['images'][$k]); } } $param['clad_image'] = $param['clad_image'].','.implode(',',$_POST['images']); } }*/ //pr($param,9); foreach ($this->otherFields as $key => $value) { if (isset($post[$key])) { $param[$key] = $post[$key]; } } $update = $this->common_model->updateData(CLASSIFIEDAD, $param, $where); if ($update) { ## Upload images /*$config['upload_path'] = DOC_ROOT_CLASSIFIED_AD; $config['allowed_types'] = 'gif|jpg|png|bmp|jpeg'; $this->load->library('upload', $config); $fileParam = array('name', 'type', 'tmp_name', 'error', 'size'); for ($i = 0; $i < count($files['images']['name']); $i++) { $imgName = $files['images']['name'][$i]; foreach ($fileParam as $j) $_FILES['images'][$j] = $files['images'][$j][$i]; $_FILES['images']['name'] = $imgName; //echo $imgName;die; if (!$this->upload->do_upload('images')) { $error = $this->upload->display_errors(); } if ($error != "") echo "Error:" . $error; }*/ // Old popup based image upload code :Mitesh /*$newimages = array_filter(explode(",",$post['newimages'])); foreach ($newimages as $img) { if(strpos($img,"tmp")!==false) { $from = './uploads/ad/'.$img; $to = './uploads/ad/'.str_replace("tmp/","",$img); rename($from, $to); } }*/ //move files from tmp to upload folder foreach ($curoldimg as $img) { $from = './uploads/ad/tmp/' . $img; $to = './uploads/ad/' . $img; rename($from, $to); } // unlink old file if (!empty($unlinkimgarr)) { foreach ($unlinkimgarr as $v) { if (file_exists(DOC_ROOT_CLASSIFIED_AD . $v)) { unlink(DOC_ROOT_CLASSIFIED_AD . $v); } } } $flash_arr = array('flash_type' => 'success', 'flash_msg' => 'Your Ad has been updated successfully'); $this->session->set_flashdata($flash_arr); redirect("myaccount/my-ad-list"); } else { $flash_arr = array('flash_type' => 'error', 'flash_msg' => 'Error Occured during processing..Please try again later.'); } } $this->session->set_flashdata($flash_arr); $data['error_msg'] = validation_errors(); //$error; } $data['otherFields'] = $this->otherFields; $data['cityArr'] = getCities(); $data['view'] = 'myAdEdit'; $data['categories'] = $this->common_model->getCategoryOrderedArray(); $this->load->view('content', $data); }
/** * Writes cache files. * @since 2.0.0 * @version 2.2.1 * @param int $cID Cache file to be created 0 = settings.php, 1 = settings_named.php, 2 = locList(a).php, 3 = meta.php, 4 = selCity(a).php, 5 = selPostal(a).php, 6 = Cache Age File (Default:0) * @param int $a [optional] Version of file to create. 0 = public calendar, 1 = admin console (Default:0, Used for $cID = 2/4/5 only.) * @return void */ function buildCache($cID = 0, $a = 0) { global $hc_cfg, $hc_lang_search; if (!is_writable(HCPATH . '/cache/')) { exit("Cache directory cannot be written to."); } $f = $a == 1 ? 'a' : ''; $hc_fetch_settings = '1,2,3,4,7,8,9,10,11,12,13,14,15,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,40,41,42,43,44,45,48,49,'; $hc_fetch_settings .= '50,51,52,54,53,55,56,59,60,61,62,63,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,'; $hc_fetch_settings .= '90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,113,114,115,126,127,128,129,130,131,132,133,134'; switch ($cID) { case 1: if (defined('HC_Named')) { if (!file_exists(HCPATH . '/cache/settings_named.php')) { $result = doQuery("SELECT PkID, Name FROM " . HC_TblPrefix . "settings WHERE PkID IN (" . $hc_fetch_settings . ") AND SettingValue != '' AND Name IS NOT NULL ORDER BY Name"); if (hasRows($result)) { ob_start(); $fp = fopen(HCPATH . '/cache/settings_named.php', 'w'); fwrite($fp, "<?php\n//\tHelios Named Config Cache - Delete this file when upgrading.\n\n"); fwrite($fp, "\$hc_cfg_named = array(\n"); while ($row = mysql_fetch_row($result)) { fwrite($fp, "'" . $row[1] . "'\t=>\t\$hc_cfg[" . $row[0] . "],\n"); } fwrite($fp, "'category_columns'\t=>\t\$hc_cfg['CatCols'],\n"); fwrite($fp, ");\n?>"); fclose($fp); ob_end_clean(); } else { exit(handleError(0, "Setting Data Missing.")); } } } break; case 2: if (!file_exists(HCPATH . '/cache/locList' . $f . '.php')) { $q = $a == 0 ? 'AND IsPublic = 1' : ''; $result = doQuery("SELECT PkID, Name FROM " . HC_TblPrefix . "locations WHERE IsActive = 1 " . $q . " ORDER BY Name"); ob_start(); $fp = fopen(HCPATH . '/cache/locList' . $f . '.php', 'w'); fwrite($fp, "<?php\n//\tHelios Location List - Delete this file when upgrading.\n\n"); fwrite($fp, "\$NewAll = (isset(\$NewAll)) ? \$NewAll : '';?>\n\n"); echo '<select name="locListI" id="locListI" onchange="if(isNaN(this.options[this.selectedIndex].value)){splitLocation(this.options[this.selectedIndex].value);}">'; if (hasRows($result)) { echo "\n\t" . '<option value="0|"><?php echo $NewAll;?></option>'; echo "\n\t" . '<option value="-1">-------------------------</option>'; while ($row = mysql_fetch_row($result)) { echo "\n\t" . '<option value="' . $row[0] . '|' . cOut($row[1]) . '">' . cOut($row[1]) . '</option>'; } } else { echo "\n\t" . '<option value="0">' . $hc_lang_core['NoLocList'] . '</option>'; } echo "\n" . '</select><br />'; fwrite($fp, ob_get_contents()); fclose($fp); ob_end_clean(); } break; case 3: if (!file_exists(HCPATH . '/cache/meta.php')) { ob_start(); $fp = fopen(HCPATH . '/cache/meta.php', 'w'); fwrite($fp, "<?php\n//\tHelios Meta Cache - Delete this file when upgrading.\n\n"); fwrite($fp, "\$hc_meta = array(\n"); $result = doQuery("SELECT * FROM " . HC_TblPrefix . "settingsmeta"); $x = 1; $pairs = array(1 => 1, 2 => 2, 3 => 'submit', 4 => 'search', 5 => 'searchresult', 6 => 'signup', 7 => 'send', 8 => 'rsvp', 9 => 'tools', 10 => 'rss', 11 => 'newsletter', 12 => 'archive', 13 => 'filter', 14 => 'digest', 15 => 'signin', 16 => 'acc'); while ($row = mysql_fetch_row($result)) { fwrite($fp, "\n'" . $pairs[$x] . "'\t=>\tarray('title' => '" . cIn($row[3]) . "', 'keywords' => '" . cIn($row[1]) . "', 'desc' => '" . cIn($row[2]) . "'),"); ++$x; } fwrite($fp, "\n);\n?>"); fwrite($fp, ob_get_contents()); fclose($fp); ob_end_clean(); } break; case 4: if (!file_exists(HCPATH . '/cache/selCity' . $f . '.php')) { ob_start(); $fp = fopen(HCPATH . '/cache/selCity' . $f . '.php', 'w'); fwrite($fp, "<?php\n//\tHelios City Select List Cache - Delete this file when upgrading.\n?>\n"); fwrite($fp, "\n<select name=\"city\" id=\"city\" disabled=\"disabled\">"); fwrite($fp, "\n<option value=\"\">" . $hc_lang_search['City0'] . "</option>"); $cities = getCities($a); foreach ($cities as $val) { if ($val != '') { fwrite($fp, "\n<option value=\"" . $val . "\">" . $val . "</option>"); } } fwrite($fp, "\n</select>"); fwrite($fp, ob_get_contents()); fclose($fp); ob_end_clean(); } break; case 5: if (!file_exists(HCPATH . '/cache/selPostal' . $f . '.php')) { ob_start(); $fp = fopen(HCPATH . '/cache/selPostal' . $f . '.php', 'w'); fwrite($fp, "<?php\n//\tHelios Postal Code Select List Cache - Delete this file when upgrading.\n?>\n"); fwrite($fp, "\n<select name=\"postal\" id=\"postal\" disabled=\"disabled\">"); fwrite($fp, "\n<option value=\"\">" . $hc_lang_search['Postal0'] . "</option>"); $codes = getPostal($a); foreach ($codes as $val) { if ($val != '') { fwrite($fp, "\n<option value=\"" . $val . "\">" . $val . "</option>"); } } fwrite($fp, "\n</select>"); fwrite($fp, ob_get_contents()); fclose($fp); ob_end_clean(); } break; case 6: $cache_date = date("Ymd"); if (!file_exists(HCPATH . '/cache/' . $cache_date . '.php')) { clearCache(); ob_start(); $fp = fopen(HCPATH . '/cache/' . $cache_date . '.php', 'w'); fwrite($fp, "<?php\n/*\n\tHelios Cache Age File. - Delete this file when upgrading.\n*/\n?>"); fclose($fp); ob_end_clean(); } break; default: if (!file_exists(HCPATH . '/cache/settings.php')) { $result = doQuery("SELECT PkID, SettingValue FROM " . HC_TblPrefix . "settings WHERE PkID IN (" . $hc_fetch_settings . ") ORDER BY PkID"); if (hasRows($result)) { ob_start(); $fp = fopen(HCPATH . '/cache/settings.php', 'w'); fwrite($fp, "<?php\n//\tHelios Config Cache - Delete this file when upgrading.\n\n"); fwrite($fp, "\$hc_cfg = array(\n"); while ($row = mysql_fetch_row($result)) { fwrite($fp, $row[0] . " => \"" . str_replace("\"", "'", $row[1]) . "\",\n"); } fwrite($fp, "200 => \"hc_" . sha1(md5(CalRoot) . HC_Rando) . "\",\n"); fwrite($fp, "201 => \"helios_" . md5(CalRoot . HC_Rando) . "\",\n"); fwrite($fp, "\"CatCols\" => \"3\",\n"); fwrite($fp, "\"CatLinks\" => \"1\",\n"); fwrite($fp, "\"IsRSVP\" => \"1\",\n"); fwrite($fp, "\"OLImages\" => \"" . CalRoot . "/img/ol/\",\n"); $resultE = doQuery("SELECT MIN(StartDate), MAX(StartDate) FROM " . HC_TblPrefix . "events WHERE IsApproved = 1 AND IsActive = 1"); if (hasRows($resultE)) { $first = strtotime(mysql_result($resultE, 0, 0)) < date("U", mktime(0, 0, 0, date("m"), date("d"), date("Y"))) ? strtotime(mysql_result($resultE, 0, 0)) : date("U", mktime(0, 0, 0, date("m"), date("d"), date("Y"))); fwrite($fp, "\"First\" => \"" . $first . "\",\n"); fwrite($fp, "\"Last\" => \"" . strtotime(mysql_result($resultE, 0, 1)) . "\",\n"); } $news = date("Y-m-d"); $resultN = doQuery("SELECT MIN(SentDate) FROM " . HC_TblPrefix . "newsletters WHERE STATUS > 0 AND IsArchive = 1 AND IsActive = 1 AND ArchiveContents != ''"); if (hasRows($resultN) && mysql_result($resultN, 0, 0) != '') { $news = mysql_result($resultN, 0, 0); } fwrite($fp, "\"News\" => \"" . $news . "\",\n"); fwrite($fp, ");\n?>"); fclose($fp); ob_end_clean(); } else { exit(handleError(0, "Setting Data Missing.")); } } break; } }
function getRegions($countries) { getInCycle('getRegions', $countries, 'country_id', 'regions'); } function getCities($countries) { getInCycle('getCities', $countries, 'country_id', 'cities'); } function getUniversities($cities) { getInCycle('getUniversities', $cities, 'city_id', 'universities'); } function getSchools($cities) { getInCycle('getSchools', $cities, 'city_id', 'schools'); } function getFaculties($universities) { getInCycle('getFaculties', $universities, 'university_id', 'faculties'); } function getChairs($faculties) { getInCycle('getChairs', $faculties, 'faculty_id', 'chairs'); } getCountries(); getRegions('countries'); getCities('countries'); getUniversities('cities'); getFaculties('universities'); getChairs('faculties'); getSchools('cities');
public function getCityList() { $post = $this->input->get(); if ($post) { $cityArr = getCities($post['term']); //pr($cityArr);die; if (!empty($cityArr)) { $res = array(); foreach ($cityArr as $k => $v) { $res[$v->city_name] = $v->city_name; } echo json_encode($res); } } }
/** * Output RSS Feed Builder tool. * @since 2.0.0 * @version 2.0.0 * @return void */ function tool_rss() { global $hc_cfg, $hc_lang_core, $hc_lang_tools; if ($hc_cfg[106] == 0) { return 0; } $cmnts = $hc_cfg[56] == 1 && $hc_cfg[25] != '' ? '<li><a href="http://' . $hc_cfg[25] . '.disqus.com/latest.rss" class="icon rss" rel="nofollow">' . $hc_lang_core['Comments'] . '</a></li>' : ''; $cnt = 1; $cities = getCities(); $colWidth = number_format(100 / $hc_cfg['CatCols'], 0); $colLimit = ceil(count($cities) / $hc_cfg['CatCols']); $city = $category = ''; $city .= ' <div class="catCol">'; foreach ($cities as $val) { if ($cnt > ceil(count($cities) / $hc_cfg['CatCols']) && $cnt > 1) { $city .= ' </div> <div class="catCol">'; $cnt = 1; } if ($val != '') { $city .= ' <label for="cityName_' . str_replace(' ', '_', $val) . '"><input onclick="updateLink();" name="cityName[]" id="cityName_' . str_replace(' ', '_', $val) . '" type="checkbox" value="' . $val . '" />' . cOut($val) . '</label>'; ++$cnt; } } $city .= ' </div>'; $result = doQuery("SELECT c.PkID, c.CategoryName, c.ParentID, c.CategoryName as Sort, NULL as Selected\r\n\t\t\t\t\t\tFROM " . HC_TblPrefix . "categories c \r\n\t\t\t\t\t\t\tLEFT JOIN " . HC_TblPrefix . "eventcategories ec ON (c.PkID = ec.CategoryID)\r\n\t\t\t\t\t\tWHERE c.ParentID = 0 AND c.IsActive = 1\r\n\t\t\t\t\t\tGROUP BY c.PkID, c.CategoryName, c.ParentID\r\n\t\t\t\t\t\tUNION SELECT c.PkID, c.CategoryName, c.ParentID, c2.CategoryName as Sort, NULL as Selected\r\n\t\t\t\t\t\tFROM " . HC_TblPrefix . "categories c \r\n\t\t\t\t\t\t\tLEFT JOIN " . HC_TblPrefix . "categories c2 ON (c.ParentID = c2.PkID) \r\n\t\t\t\t\t\t\tLEFT JOIN " . HC_TblPrefix . "eventcategories ec ON (c.PkID = ec.CategoryID) \r\n\t\t\t\t\t\tWHERE c.ParentID > 0 AND c.IsActive = 1\r\n\t\t\t\t\t\tGROUP BY c.PkID, c.CategoryName, c.ParentID, c2.CategoryName\r\n\t\t\t\t\t\tORDER BY Sort, ParentID, CategoryName"); if (hasRows($result)) { $cnt = 1; $category .= ' <div class="catCol">'; while ($row = mysql_fetch_row($result)) { if ($cnt > ceil(mysql_num_rows($result) / $hc_cfg['CatCols']) && $row[2] == 0) { $category .= $cnt > 1 ? ' </div>' : ''; $category .= ' <div class="catCol">'; $cnt = 1; } $sub = $row[2] != 0 ? ' class="sub"' : ''; $check = $row[4] != '' ? 'checked="checked" ' : ''; $category .= ' <label for="catID_' . $row[0] . '"' . $sub . '><input onclick="updateLink();" name="catID[]" id="catID_' . $row[0] . '" type="checkbox" value="' . $row[0] . '" />' . cOut($row[1]) . '</label>'; ++$cnt; } $category .= ' </div>'; } echo ' <h3>' . $hc_lang_tools['RSSPreset'] . '</h3>'; theme_links(); echo ' <h3>' . $hc_lang_tools['RSSBuilder'] . '</h3> <p>' . $hc_lang_tools['CreateInstruct'] . '</p> <form name="frmEventRSS" id="frmEventRSS" method="post" action="' . CalRoot . '/index.php?com=rss" target="_blank" onsubmit="return false;"> <fieldset> <legend>' . $hc_lang_tools['Cities'] . '</legend> ' . $city . ' </fieldset> <fieldset> <legend>' . $hc_lang_tools['Categories'] . '</legend> ' . $category . ' </fieldset> <fieldset> <legend>' . $hc_lang_tools['PasteInstruct'] . '</legend> <input onclick="this.focus();this.select();" readonly="readonly" name="rssLink" id="rssLink" type="text" style="width:95%;" maxlength="200" value="' . CalRoot . '/rss/feed.php" /> </fieldset> <input name="reset" id="reset" type="reset" value="' . $hc_lang_tools['StartOver'] . '" /> </form>'; }
/** * Output Calendar Filter Form * @since 2.0.0 * @version 2.0.0 * @return void */ function filter() { global $hc_cfg, $hc_lang_filter; if (isset($_GET['msg'])) { switch ($_GET['msg']) { case "1": feedback(1, $hc_lang_filter['Feed01']); break; case "2": feedback(1, $hc_lang_filter['Feed02']); break; } } $cnt = 0; $cookie = isset($_COOKIE[$hc_cfg[201] . '_fc']) || isset($_COOKIE[$hc_cfg[201] . '_fn']) ? ' checked="checked"' : ''; $cities = getCities(); $colWidth = number_format(100 / $hc_cfg['CatCols'], 0); $colLimit = ceil(count($cities) / $hc_cfg['CatCols']); $actCities = isset($_SESSION['hc_favCity']) ? $_SESSION['hc_favCity'] : array(); $city = $category = ''; $city .= ' <div class="catCol">'; foreach ($cities as $val) { if ($cnt > ceil(count($cities) / $hc_cfg['CatCols']) && $cnt > 1) { $city .= ' </div> <div class="catCol">'; $cnt = 1; } if ($val != '') { $chk = in_array(html_entity_decode($val, ENT_QUOTES), array_filter($actCities, 'html_entity_decode')) === false ? '' : ' checked="checked"'; $city .= ' <label for="cityName_' . $val . '"><input' . $chk . ' name="cityName[]" id="cityName_' . $val . '" type="checkbox" value="' . $val . '" />' . cOut($val) . '</label>'; ++$cnt; } } $city .= ' </div>'; $query = NULL; if (isset($_SESSION['hc_favCat'])) { $query = "SELECT c.PkID, c.CategoryName, c.ParentID, c.CategoryName as Sort, c2.PkID as Selected\r\n\t\t\t\t\t\tFROM " . HC_TblPrefix . "categories c \r\n\t\t\t\t\t\t\tLEFT JOIN " . HC_TblPrefix . "categories c2 ON (c.PkID = c2.PkID AND c.PkID IN (" . $_SESSION['hc_favCat'] . "))\r\n\t\t\t\t\t\t\tLEFT JOIN " . HC_TblPrefix . "eventcategories ec ON (c.PkID = ec.CategoryID)\r\n\t\t\t\t\t\tWHERE c.ParentID = 0 AND c.IsActive = 1\r\n\t\t\t\t\t\tGROUP BY c.PkID, c.CategoryName, c.ParentID, c2.PkID\r\n\t\t\t\t\t\tUNION \r\n\t\t\t\t\t\tSELECT c.PkID, c.CategoryName, c.ParentID, c2.CategoryName as Sort, c3.PkID as Selected\r\n\t\t\t\t\t\tFROM " . HC_TblPrefix . "categories c \r\n\t\t\t\t\t\t\tLEFT JOIN " . HC_TblPrefix . "categories c2 ON (c.ParentID = c2.PkID)\r\n\t\t\t\t\t\t\tLEFT JOIN " . HC_TblPrefix . "categories c3 ON (c.PkID = c3.PkID AND c.PkID IN (" . $_SESSION['hc_favCat'] . "))\r\n\t\t\t\t\t\t\tLEFT JOIN " . HC_TblPrefix . "eventcategories ec ON (c.PkID = ec.CategoryID)\r\n\t\t\t\t\t\tWHERE c.ParentID > 0 AND c.IsActive = 1\r\n\t\t\t\t\t\tGROUP BY c.PkID, c.CategoryName, c.ParentID, c2.CategoryName, c3.PkID\r\n\t\t\t\t\t\tORDER BY Sort, ParentID, CategoryName"; } echo ' <form name="frmEventFilter" id="frmEventFilter" method="post" action="' . CalRoot . '/filter.php" onsubmit="return validate();"> <input type="hidden" name="f" id="f" value="1" /> <span class="frm_ctrls"> <label><input name="cookieme" id="cookieme" type="checkbox"' . $cookie . '>' . $hc_lang_filter['Remember'] . '</label> </span> <fieldset> <legend>' . $hc_lang_filter['Cities'] . '</legend> ' . $city . ' </fieldset> <fieldset> <legend>' . $hc_lang_filter['Categories'] . '</legend>'; getCategories('frmEventFilter', $hc_cfg['CatCols'], $query, 1); echo ' </fieldset> <input name="submit" id="submit" type="submit" value="' . $hc_lang_filter['SetFilter'] . '" /> <input name="clear" id="clear" type="button" onclick="window.location.href=\'' . CalRoot . '/filter.php?clear=1\';return false;" value="' . $hc_lang_filter['ClearFilter'] . '" /> </form>'; }
$response->withJson(array("status" => 1, "message" => "City Id {$args['id']} does not exists")); } }); // select one language, using it's id $app->get("/language/{id}/", function ($request, $response, $args) use($link) { $language = getId($args['id'], 'languages'); if ($language) { return $response->withJson(array("status" => 0, "Id" => $language['id'], "Name" => $language['name'])); } else { $response->withJson(array("status" => 1, "message" => "Language Id {$args['id']} does not exists")); } }); // select all cities usind id wia ajax (service handler) $app->get("/cities/{id}/", function ($request, $response, $args) use($link) { //$post=$request->getParsedBody(); $output = getCities($args['id']); $response->getBody()->write($output['options']); return $response; }); // select all languages usind id wia ajax (service handler) $app->get("/languages/{id}/", function ($request, $response, $args) use($link) { //$post=$request->getParsedBody(); $output = getLanguages($args['id']); $response->getBody()->write($output['options']); return $response; }); /* Edit country using Id */ $app->put("/country/{id}/", function ($request, $response, $args) use($link) { $put = $request->getParsedBody(); $name = clearStr($put['Name']); $id = getId($args['id'], 'countries');
$radio = 'textfield'; } $form['#attached']['js'] = array(drupal_get_path('module', 'agent') . '/js/validate.js'); $form['#attached']['css'] = array(drupal_get_path('module', 'broker') . '/css/global-c2s.css'); // ========== Form Starts ================ // $form['Charity Edit Buttons'] = array('#type' => 'item', '#suffix' => '<div class="seperator" style="height: 10px;width: 100%;float: left;clear: both;"></div>'); $form['form_start'] = array('#type' => 'item', '#suffix' => '<div id="main-form-wrapper">' . '<div id="icon-block">' . '<div id="edit-icon" style="float:left"> <a href="../add/' . $charity_organization_id . '"> Edit </a> | </div>' . '<div id="delete-icon" onclick="window.location=\'' . base_path() . 'c2s/broker/deactivate/' . $charity_organization_id . '/' . $charity_organization_id . '\'" style="float:left" > <a href="#"> Delete </a> </div> ' . '</div>' . '<div id="form_sections" class="form_sections">'); $form['charity_organization_id'] = array('#type' => 'hidden', '#default_value' => $charity_organization_id); $form['charity_organization_name'] = array('#title' => 'Charity Organizations Name', '#type' => 'textfield', '#maxlength' => 50, $required_disabled => 'true', '#value' => $charity_org_name, '#attributes' => array('placeholder' => t('Charity Organizations Name'), 'class' => array($input_class), 'onKeyPress' => array('return isAlphaNumeric(event, this);')), '#prefix' => '<span class="wrapper-w50">', '#suffix' => '</span>'); $form['number_501_c_3'] = array('#title' => '501 (c)(3) Number', '#type' => 'textfield', '#maxlength' => 10, $required_disabled => 'true', '#default_value' => $number_501_c_3, '#attributes' => array('placeholder' => t('Type Min 3 Chars'), 'class' => array($input_class), 'onKeyPress' => array('return isAlphaNumeric(event, this);')), '#prefix' => '<span class="wrapper-w50">', '#suffix' => '</span>'); $form['street_address'] = array('#title' => 'Street Address', '#type' => 'textfield', '#maxlength' => 100, $required_disabled => 'true', '#default_value' => $charity_org_address, '#attributes' => array('placeholder' => t('Street Address'), 'class' => array($input_class), 'onKeyPress' => array('return isAlphaNumeric(event, this);')), '#prefix' => '<span class="wrapper-w50">', '#suffix' => '</span>'); //-------------- Ajax CallBack for Cities and ZipCodes --------------------- $selected_state_id = isset($form_state['values']['state_id']) ? $form_state['values']['state_id'] : $charity_org_state; //drupal_set_message('state = '.$form_state['values']['state_id']); $form['state_id'] = array('#type' => 'select', '#title' => t('State'), '#options' => $state_options, '#default_value' => $selected_state_id, $required_disabled => 'true', '#attributes' => array('class' => array($select_class), 'autocomplete' => 'off'), '#ajax' => array('callback' => 'find_cities_callback', 'wrapper' => 'cities-wrapper'), '#prefix' => '<span class="wrapper-w16">', '#suffix' => '</span>'); $city_options = getCities($selected_state_id); if (isset($form_state['values']['city'])) { $selected_city = isset($form_state['values']['city']) ? $form_state['values']['city'] : key($city_options); } else { $selected_city = ''; } $form['city'] = array('#type' => 'select', '#title' => t('City'), $required_disabled => 'true', '#default_value' => $charity_org_city, '#options' => $city_options, '#attributes' => array('placeholder' => t(''), 'class' => array($select_class)), '#ajax' => array('callback' => 'find_zip_callback', 'wrapper' => 'zip-wrapper'), '#prefix' => '<div id="cities-wrapper"> <span class="wrapper-w16"> state = ' . $selected_state_id, '#suffix' => '</span></div>'); $zip = getZip($selected_city, $selected_state_id); $form['zip_code'] = array('#title' => 'Zip Code', '#type' => 'textfield', '#maxlength' => 25, $required_disabled => 'true', '#default_value' => $zip, '#attributes' => array('placeholder' => t('Zip Code'), 'class' => array($input_class), 'readonly' => 'readonly'), '#prefix' => '<div id="zip-wrapper"><span class="wrapper-w16">', '#suffix' => '</span></div>'); // ======================================================================== /* //-------------- Ajax CallBack for Cities and ZipCodes --------------------- if (isset($form_state['values']['state_id'])) { $selected_state_id = isset($form_state['values']['state_id']) ? $form_state['values']['state_id'] : key($state_options); }else{
*/ error_reporting(E_ALL); require_once 'AWSSDKforPHP/sdk.class.php'; require_once 'include/cloudfunctions.inc.php'; // Get city and state from request if (isset($_GET['city']) && isset($_GET['state']) && preg_match("/^[A-Za-z\\+ ]{1,}\$/", $_GET['city']) && preg_Match("/^[A-Z]{2}\$/", $_GET['state'])) { $currentCity = urldecode($_GET['city']); $currentState = urldecode($_GET['state']); } else { $currentCity = null; $currentState = null; } // Create access object $sdb = new AmazonSDB(); // Fetch city list $cities = getCities($sdb); // If City and State supplied, generate list of items $itemCat = array(); if ($currentCity != '' && $currentState != '') { // Fetch list of items $items = getItems($sdb, $currentCity, $currentState); // Reorganize by category foreach ($items as $key => $attrs) { $category = $attrs['Category']; if (!isset($itemCat[$category])) { $itemCat[$category] = array(); } $itemCat[$category][$key] = $attrs; } } include 'include/cloudlist.html.php';
?> > <label for="countryName"><em>Please enter country name: </em></label> <input type="text" id="countryName" name="countryName" value="<?php echo $countryName; ?> "> <input type="submit" value="Submit"> </div> </div> </div> <div class="col-lg-6 col-md-6 selection" > <h5><em>Select city:</em></h5> <select name="city" id="cities" onchange="citySelect(this.value)" > <?php if ($cities = getCities($selectedCountry, $selectedCity)) { echo $cities['options']; $selectedCity = $cities['selected']; } ?> <script> citySelect(<?php echo $selectedCity; ?> ); </script> </select> <div class="row"> <div class="col-lg-3 col-md-3 col-sm-5 col-xs-5 col-lg-offset-9 col-md-offset-9 col-sm-offset-7 col-xs-offset-7 editor" id="cityEditor"></div> </div> <div class="row">