$config = Config::getConfig('common');
$contract_carriers = $config[$market . "_" . $clearing . '_contract_carriers']; // f**ing php array
$interline_carriers = $config[$market . "_" . $clearing . '_interline_carriers']; // another f**ing array
// $marketing_carriers - is also array
$sets = [];
foreach ($marketing_carriers as $mc) {
$sets[] = array_unique(array_intersect(
array_merge(
[$mc],
array_intersect(
isset(self::$interlines[$mc]) ? self::$interlines[$mc] : [],
array_merge(
$marketing_carriers,
$interline_carriers
)
)
),
$contract_carriers
));
}
date('Y-m-d').'T'.date("H:i:s", strtotime("- 1 hour")).'Z'
Back to the future
//Говорящие названия - такие говорящие!
function asdfasdf (WebAPI_Entity $screenshot_dictionary)
{
$result = array();
foreach ($screenshot_dictionary->getEntities () as $scr)
{
$result [] = $scr->toObject ();
}
usort($result, array ($this, 'sortScreenshots'));
return $this->prepare_screenshots ($result);
}
// вставляем остальные скриншоты
$elements = $this->asdfasdf ($screenshot_dictionary);
<?php
public function parse($package)
{
if(isset($package["type"]) && $package["type"] == "unavailable")
{
if(((time() - self::$xmpp->users[(string)$package["from"]]["jointime"] < 30 && (isset(self::$xmpp->users[(string)$package["from"]]["messages"]) && self::$xmpp->users[(string)$package["from"]]["messages"] < 2) && (time() - self::$xmpp->startTime) > 50)) || (!isset(self::$xmpp->users[(string)$package["from"]]["messages"]) && time() - self::$xmpp->users[(string)$package["from"]]["jointime"] < 900 && (time() - self::$xmpp->startTime) > 900))
{
if(!array_search(strstr(self::$xmpp->users[(string)$package["from"]]["jid"], "/", true), explode("\n", file_get_contents("friends.txt"))))
{
self::$xmpp->ban(strstr($package["from"], "/", true), self::$xmpp->users[(string)$package["from"]]["jid"]);
self::$xmpp->groupMessage(strstr($package["from"], "/", true), substr(strstr($package["from"], "/"), 1)." został zbanowany/a za przeciąg!");
}
}
else
if(!array_search(strstr(self::$xmpp->users[(string)$package["from"]]["jid"], "/", true), explode("\n", file_get_contents("friends.txt"))))
file_put_contents("friends.txt", file_get_contents("friends.txt")."\n".strstr(self::$xmpp->users[(string)$package["from"]]["jid"], "/", true));
}
}
In fact whole project is shitty as hell, if you want have some fun grab popcorn and read all the sources: XPBot on sourceforge
<input type="button" value="Go and fill later" onclick="javascript:window.location='<?php echo $url; ?>info.php'" />
Well, a
is obsolete, let's do links as buttons!
<?php
$now = time();
while ($now + 10 > time()) {
// Just chill...smoke a blunt
}
echo "Done.\n";
$gallery = \common\models\UtVideogallery::find()->select(['ut_videogallery.VideogalleryID',
'ut_videogallery.Name_rus','ut_videogallery.TournamentID','ut_videogallery.MatchID', 'Slug',
'ut_videogallery.Date','COUNT(ut_video_to_gallery.VideoToGalleryID) count','ut_matches_videos.Data',
'm1.Data DataP'])
->leftJoin('ut_video_to_gallery','ut_video_to_gallery.VideogalleryID=ut_videogallery.VideogalleryID')
->leftJoin('ut_matches_videos','ut_matches_videos.VideoID=ut_video_to_gallery.VideoID')
->leftJoin('ut_matches_videos m1','m1.VideoID=ut_videogallery.PreviewID')
->where(['ut_videogallery.Active'=>1])
//->andWhere(['TournamentID'=>$list['selected']])
->groupBy('ut_videogallery.VideogalleryID')
->orderBy('ut_videogallery.Date DESC')
->limit(self::$countPerPage)
->asArray()->all();
foreach ($gallery as $key => $value) {
if($value['count']==0) unset($gallery[$key]);
}
foreach($gallery as $k=>$v){
if(isset($v['Data']))
$v['Data'] = str_replace('http:','https:',$v['Data']);
if(isset($v['DataP']))
$v['DataP'] = str_replace('http:','https:',$v['DataP']);
$gallery[$k]=$v;
}
$galleryCount = \common\models\UtVideogallery::find()->select(['ut_videogallery.VideogalleryID',
'ut_videogallery.Name_rus','ut_videogallery.TournamentID','ut_videogallery.MatchID',
'ut_videogallery.Date','COUNT(ut_video_to_gallery.VideoToGalleryID) count','ut_matches_videos.Data'])
->leftJoin('ut_video_to_gallery','ut_video_to_gallery.VideogalleryID=ut_videogallery.VideogalleryID')
->leftJoin('ut_matches_videos','ut_matches_videos.VideoID=ut_video_to_gallery.VideoID')
->leftJoin('ut_matches_videos m1','m1.VideoID=ut_videogallery.PreviewID')
->where(['ut_videogallery.Active'=>1])
//->andWhere(['TournamentID'=>$list['selected']])
->groupBy('ut_videogallery.VideogalleryID')
->orderBy('ut_videogallery.Date DESC')
->asArray()->all();
foreach ($galleryCount as $key => $value) {
if($value['count']==0) unset($galleryCount[$key]);
}
$pagination = new \yii\data\Pagination(
[
'totalCount' => count($galleryCount),
'pageSize' => self::$countPerPage,
]);
Picasso of PHP
try {
$order->addItem($item);
} catch (Exception $ex) {
throw $ex;
}
if((substr($onefile, -4) == ".Mp3") OR
(substr($onefile, -4) == ".ogg") OR
(substr($onefile, -4) == ".OGG") OR
(substr($onefile, -4) == ".oGG") OR
(substr($onefile, -4) == ".OGg") OR
(substr($onefile, -4) == ".Ogg") OR
(substr($onefile, -4) == ".OgG") OR
(substr($onefile, -4) == ".mP3") OR
(substr($onefile, -4) == ".MP3") OR
(substr($onefile, -4) == ".mp3")){
// do stuff
}
gotta make sure you account for capitalization
public function getProduct($product_id) {
$query = $this->db->query("SELECT DISTINCT *, pd.name AS name, p.image, m.name AS manufacturer, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special, (SELECT points FROM " . DB_PREFIX . "product_reward pr WHERE pr.product_id = p.product_id AND pr.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "') AS reward, (SELECT ss.name FROM " . DB_PREFIX . "stock_status ss WHERE ss.stock_status_id = p.stock_status_id AND ss.language_id = '" . (int)$this->config->get('config_language_id') . "') AS stock_status, (SELECT wcd.unit FROM " . DB_PREFIX . "weight_class_description wcd WHERE p.weight_class_id = wcd.weight_class_id AND wcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS weight_class, (SELECT lcd.unit FROM " . DB_PREFIX . "length_class_description lcd WHERE p.length_class_id = lcd.length_class_id AND lcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS length_class, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT COUNT(*) AS total FROM " . DB_PREFIX . "review r2 WHERE r2.product_id = p.product_id AND r2.status = '1' GROUP BY r2.product_id) AS reviews, p.sort_order FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) WHERE p.product_id = '" . (int)$product_id . "' AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");
/* ... */
Opencart's Product model
if (!empty($tickets)) {
if (count($tickets)) {
$c_start = strtotime($convetion_details['start']);
$c_end = strtotime($convetion_details['end']);
$i = 0;
while ($c_start <= $c_end) {
if (is_int($i / 4) && $i > 0) $convetion_days_html .= '</tr><tr>';
$convetion_days_html .= '<td>' . date('d.m', $c_start) . ' ' . __t($days_of_week[date('w', $c_start)]) . ' <img src="' . str_replace('https', 'http', TEMPLATE_WWWPATH) . '/images/checkbox.png"/></td>';
$c_start = strtotime('+1 day', $c_start);
$i++;
}
//...
legacy code from 2007 indians
<?php
foreach (array_keys($values['services']) as $serviceId) {
$service = $this->_em->find('\cut\Entity\Service', $serviceId);
//\Doctrine\Common\Util\Debug::print_r($service); exit();
//$reservation->addService($this->_em->find('\cut\Entity\Service', $serviceId));
$this->view->serviceDeposits[$serviceId] = $service->getDeposit();
}
# checkign if clinic want's bill
$notifications = array();
$reservationServices = array();
foreach (array_keys($values['services']) as $serviceId) {
$reservationServices[$serviceId] = new \cut\Entity\ReservationService();
$service = $this->_em->find('\cut\Entity\Service', $serviceId);
//\Doctrine\Common\Util\Debug::print_r($service); exit();
$reservationServices[$serviceId]->setService($service);
$reservationServices[$serviceId]->setReservation($reservation);
$reservationServices[$serviceId]->setPatient($this->_helper->LoggedUser());
switch ($service->getDeposit()) {
case 'yes':
$reservationServices[$serviceId]->setBillStatus(\cut\Entity\ReservationService::BILL_STATUS_NOT_PAID);
break;
default:
$reservationServices[$serviceId]->setBillStatus(\cut\Entity\ReservationService::BILL_STATUS_NOT_WANTED);
}
$this->view->serviceDeposits[$serviceId] = $service->getDeposit();
}
<?php
private function redirectFromOldSlug($pSlug, $pLanguageCode)
{
/*
$redirectArray[3][1] = 'beauty-young';
$redirectArray[3][2] = 'beauty-and-rejuvenation';
$redirectArray[3][3] = 'beauty-young';
$redirectArray[3][4] = 'beauty-young';
$redirectArray[2][1] = 'beauty-slim';
$redirectArray[2][2] = 'beauty-slim';
$redirectArray[2][3] = 'beauty-slim';
$redirectArray[2][4] = 'beauty-slim';
$redirectArray[18][1] = 'white-smile---2-dniowy-pakiet';
$redirectArray[18][2] = 'white-smile-2---day-package-hilton-hotel';
$redirectArray[18][3] = 'white-smile';
$redirectArray[18][4] = 'white-smile---2---day-package';
$redirectArray[17][1] = 'zdrowie-z-pieknem';
$redirectArray[17][2] = 'healthy-and-beauty-2---day-with-dentist-botox';
$redirectArray[17][3] = 'gesundheit-von-schonheit-2-tage';
$redirectArray[17][4] = 'vard-av-skonhet-2-dagar';
$redirectArray[19][1] = 'beauty-care';
$redirectArray[19][2] = 'beauty-care';
$redirectArray[19][3] = 'beauty-care';
$redirectArray[19][4] = 'beauty-care';
$redirectArray[21][1] = 'luksus-spa---hilton-w-gdasku';
$redirectArray[21][2] = 'spa-in-hilton-hotel';
$redirectArray[21][3] = 'spa-im-hilton---fur-sie';
$redirectArray[21][4] = 'spa-pa-hilton---for-dig';
$redirectArray[26][1] = 'zabiegi-implantacji-w-sea-tower';
$redirectArray[26][2] = 'implant-treatments-in-the-sea-tower';
$redirectArray[26][3] = 'implantate-in-der-sea-tower';
$redirectArray[26][4] = 'implantat-i-sea-tower';
$redirectArray[23][1] = 'mezoterapia-peeling-lipoliza-botox-hialuron';
$redirectArray[23][2] = 'beauty-med';
$redirectArray[23][3] = 'beauty-med';
$redirectArray[23][4] = 'beauty-med';
$redirectArray[34][1] = 'paski-brzuch-w-8-dni';
$redirectArray[34][2] = 'special-abdomen-programme';
$redirectArray[34][3] = 'das-speziell-gestaltete-und-vorbereitete-programm';
$redirectArray[34][4] = 'ett-speciellt-utformat-program';
$redirectArray[27][1] = 'zdrowy-kregosup';
$redirectArray[27][2] = 'healthy-spine-clinic';
$redirectArray[27][3] = 'wirbelsaule-ist-die-basis';
$redirectArray[27][4] = 'frisk-ryggrad';
$redirectArray[5][1] = 'pakiet-stomatologiczny-hotel-hilton';
$redirectArray[5][2] = 'healthy-smile-2-day-dental-package-hilton-hotel';
$redirectArray[5][3] = 'healthy-smile-2---day---dental-package-hotel-hilton';
$redirectArray[5][4] = 'healthy-smile-2---day---dental-package-hotel-hilton';
$redirectArray[16][1] = 'beauty-calming--anti-redness-2-dni';
$redirectArray[16][2] = 'beauty-calming--anti-redness-2-days';
$redirectArray[16][3] = 'beauty-calming--anti-redness';
$redirectArray[16][4] = 'beauty-calming--anti-redness';
$redirectArray[22][1] = 'stomatolog-na-twoja-kiesze';
$redirectArray[22][2] = 'dentist-for-every-pocket';
$redirectArray[22][3] = 'zahnarzt-fur-jedes-budget';
$redirectArray[22][4] = 'tandlakare-for-varje-budget';
$redirectArray[25][1] = 'przeglad-stomatologiczny-wybielanie-zebow';
$redirectArray[25][2] = 'teeth-whitening';
$redirectArray[25][3] = 'zahnaufhellung';
$redirectArray[25][4] = 'tandblekning';
$redirectArray[24][1] = 'implant-w-dwa-dni';
$redirectArray[24][2] = 'lifelong-guarantee-for-implants';
$redirectArray[24][3] = 'lebenslange-garantie-fur-implantate';
$redirectArray[24][4] = 'livslangt-garanti-for-implantat';
$redirectArray[39][1] = 'nogi-bez-zylakow';
$redirectArray[39][2] = 'varicose';
$redirectArray[39][3] = 'das-venefit-verfahren';
$redirectArray[39][4] = 'forfarande-venefit';
$redirectArray[36][1] = 'rehabilitacja-narzadu-ruch';
$redirectArray[36][2] = 'locomotor-system-14-day-stay-in-the-health-resort';
$redirectArray[36][3] = 'rehabilitation-14-tage-aufenthalt-im-sanatorium';
$redirectArray[36][4] = 'rorelseapparaten---rehabiliteringsemester';
$redirectArray[35][1] = 'zdrowe-serce-14-dniowy-program';
$redirectArray[35][2] = 'cardiology-14-day-stay-in-the-health-resort';
$redirectArray[35][3] = 'kardiologie---14-tage-aufenthalt-im-sanatorium';
$redirectArray[35][4] = 'kardiologi---rehabiliteringsemester';
$redirectArray[37][1] = 'stomatolog-w-szczecinie';
$redirectArray[37][2] = 'dentist-in-szczecin';
$redirectArray[37][3] = 'zahnarzt-in-szczecin';
$redirectArray[37][4] = 'tandlakare-i-szczecin';
$redirectArray[32][1] = 'sanatorium-z-rehabilitacja-narza';
$redirectArray[32][2] = 'physical-medicine-and-rehabilita';
$redirectArray[32][3] = 'rehabilitation-bewegungs';
$redirectArray[32][4] = 'rehabilitation-behandlingar';
*
*/
$redirectArray = array();
$redirectArray['beauty-young']['pl'] = 3;
$redirectArray['beauty-slim']['pl'] = 2;
$redirectArray['white-smile---2-dniowy-pakiet']['pl'] = 18;
$redirectArray['zdrowie-z-pieknem']['pl'] = 17;
$redirectArray['beauty-care']['pl'] = 19;
$redirectArray['luksus-spa---hilton-w-gdasku']['pl'] = 21;
$redirectArray['zabiegi-implantacji-w-sea-tower']['pl'] = 26;
$redirectArray['mezoterapia-peeling-lipoliza-botox-hialuron']['pl'] = 23;
$redirectArray['paski-brzuch-w-8-dni']['pl'] = 34;
$redirectArray['zdrowy-kregosup']['pl'] = 27;
$redirectArray['pakiet-stomatologiczny-hotel-hilton']['pl'] = 5;
$redirectArray['beauty-calming--anti-redness-2-dni']['pl'] = 16;
$redirectArray['stomatolog-na-twoja-kiesze']['pl'] = 22;
$redirectArray['przeglad-stomatologiczny-wybielanie-zebow']['pl'] = 25;
$redirectArray['implant-w-dwa-dni']['pl'] = 24;
$redirectArray['nogi-bez-zylakow']['pl'] = 39;
$redirectArray['rehabilitacja-narzadu-ruch']['pl'] = 36;
$redirectArray['zdrowe-serce-14-dniowy-program']['pl'] = 35;
$redirectArray['stomatolog-w-szczecinie']['pl'] = 37;
$redirectArray['sanatorium-z-rehabilitacja-narza']['pl'] = 32;
$redirectArray['beauty-and-rejuvenation']['en'] = 3;
$redirectArray['beauty-slim']['en'] = 2;
$redirectArray['white-smile-2---day-package-hilton-hotel']['en'] = 18;
$redirectArray['healthy-and-beauty-2---day-with-dentist-botox']['en'] = 17;
$redirectArray['beauty-care']['en'] = 19;
$redirectArray['spa-in-hilton-hotel']['en'] = 21;
$redirectArray['implant-treatments-in-the-sea-tower']['en'] = 26;
$redirectArray['beauty-med']['en'] = 23;
$redirectArray['special-abdomen-programme']['en'] = 34;
$redirectArray['healthy-spine-clinic']['en'] = 27;
$redirectArray['healthy-smile-2-day-dental-package-hilton-hotel']['en'] = 5;
$redirectArray['beauty-calming--anti-redness-2-days']['en'] = 16;
$redirectArray['dentist-for-every-pocket']['en'] = 22;
$redirectArray['teeth-whitening']['en'] = 25;
$redirectArray['lifelong-guarantee-for-implants']['en'] = 24;
$redirectArray['varicose']['en'] = 39;
$redirectArray['locomotor-system-14-day-stay-in-the-health-resort']['en'] = 36;
$redirectArray['cardiology-14-day-stay-in-the-health-resort']['en'] = 35;
$redirectArray['dentist-in-szczecin']['en'] = 37;
$redirectArray['physical-medicine-and-rehabilita']['en'] = 32;
$redirectArray['beauty-young']['de'] = 3;
$redirectArray['beauty-slim']['de'] = 2;
$redirectArray['white-smile']['de'] = 18;
$redirectArray['gesundheit-von-schonheit-2-tage']['de'] = 17;
$redirectArray['beauty-care']['de'] = 19;
$redirectArray['spa-im-hilton---fur-sie']['de'] = 21;
$redirectArray['implantate-in-der-sea-tower']['de'] = 26;
$redirectArray['beauty-med']['de'] = 23;
$redirectArray['das-speziell-gestaltete-und-vorbereitete-programm']['de'] = 34;
$redirectArray['wirbelsaule-ist-die-basis']['de'] = 27;
$redirectArray['healthy-smile-2---day---dental-package-hotel-hilton']['de'] = 5;
$redirectArray['beauty-calming--anti-redness']['de'] = 16;
$redirectArray['zahnarzt-fur-jedes-budget']['de'] = 22;
$redirectArray['zahnaufhellung']['de'] = 25;
$redirectArray['lebenslange-garantie-fur-implantate']['de'] = 24;
$redirectArray['das-venefit-verfahren']['de'] = 39;
$redirectArray['rehabilitation-14-tage-aufenthalt-im-sanatorium']['de'] = 36;
$redirectArray['kardiologie---14-tage-aufenthalt-im-sanatorium']['de'] = 35;
$redirectArray['zahnarzt-in-szczecin']['de'] = 37;
$redirectArray['rehabilitation-bewegungs']['de'] = 32;
$redirectArray['beauty-young']['sv'] = 3;
$redirectArray['beauty-slim']['sv'] = 2;
$redirectArray['white-smile---2---day-package']['sv'] = 18;
$redirectArray['vard-av-skonhet-2-dagar']['sv'] = 17;
$redirectArray['beauty-care']['sv'] = 19;
$redirectArray['spa-pa-hilton---for-dig']['sv'] = 21;
$redirectArray['implantat-i-sea-tower']['sv'] = 26;
$redirectArray['beauty-med']['sv'] = 23;
$redirectArray['ett-speciellt-utformat-program']['sv'] = 34;
$redirectArray['frisk-ryggrad']['sv'] = 27;
$redirectArray['healthy-smile-2---day---dental-package-hotel-hilton']['sv'] = 5;
$redirectArray['beauty-calming--anti-redness']['sv'] = 16;
$redirectArray['tandlakare-for-varje-budget']['sv'] = 22;
$redirectArray['tandblekning']['sv'] = 25;
$redirectArray['livslangt-garanti-for-implantat']['sv'] = 24;
$redirectArray['forfarande-venefit']['sv'] = 39;
$redirectArray['rorelseapparaten---rehabiliteringsemester']['sv'] = 36;
$redirectArray['kardiologi---rehabiliteringsemester']['sv'] = 35;
$redirectArray['tandlakare-i-szczecin']['sv'] = 37;
$redirectArray['rehabilitation-behandlingar']['sv'] = 32;
if (!empty($redirectArray[$pSlug][$pLanguageCode]))
{
$packageId = $redirectArray[$pSlug][$pLanguageCode];
$package = $this->packagesInstance->getPackageByIdAndLang($packageId, $pLanguageCode);
if (!empty($package))
{
$this->redirect('package/'.$package['slug'], array('code' => 301));
}
}
}