function desactiva($id) { $id = $this->_bd->limpia($id); $now = Time("U"); $sql = "UPDATE $this->_dbTable SET ESTADO_ACCION = 0, LastUpdateTime = '$now' WHERE ID_ACCION = $id"; // echo $sql."<br>"; $res = $this->_bd->sql($sql); }
function On_PostAction_iterator_fetch($a_data) { // Find iterator in template $doc = new Template_Document($a_data->post['iterator_template']); function search_func($node, $args) { if ($node instanceof Template_TagNode) { return $node->getAttribute("name") == $args; } else { return false; } } $itrs = $doc->getElementsByFunc(search_func, $a_data->post['iterator_name']); $iterator = $itrs[0]; // Generate id $id = Time("U") . substr((string) microtime(), 2, 6); // Build iterator template $node = new Node(-$id); $node->Build($iterator); // Pack JSON data $data = array(); $data['id'] = $id; $data['content'] = Editor::$m_data['module_data'][-$id]; print json_encode($data); }
function ExecuteQuery() { $this->data = array(); $date = new DateTimeValue(Time()); $notYet = ProjectTasks::findAll(array('conditions' => 'created_by_id = ' . logged_user()->getId() . ' AND ( due_date = \'0000-00-00 00:00:00\' OR due_date > \'' . substr($date->toMySQL(), 0, strpos($date->toMySQL(), ' ')) . "')")); $today = ProjectTasks::findAll(array('conditions' => 'created_by_id = ' . logged_user()->getId() . ' AND due_date = \'' . substr($date->toMySQL(), 0, strpos($date->toMySQL(), ' ')) . "'")); $past = ProjectTasks::findAll(array('conditions' => 'created_by_id = ' . logged_user()->getId() . ' AND due_date > \'1900-01-01 00:00:00\' AND due_date < \'' . substr($date->toMySQL(), 0, strpos($date->toMySQL(), ' ')) . "'")); $value = 0; if (isset($past)) { $value = count($past); } $this->data['values'][0]['labels'][] = 'Overdue'; $this->data['values'][0]['values'][] = $value; $value = 0; if (isset($notYet)) { $value = count($notYet); } $this->data['values'][0]['labels'][] = 'Not yet due'; $this->data['values'][0]['values'][] = $value; $value = 0; if (isset($today)) { $value = count($today); } $this->data['values'][0]['labels'][] = 'Due today'; $this->data['values'][0]['values'][] = $value; }
function JPGText($str, $fontname, $fontsize, $backcol, $txtcol) { global $layout; Header("Last-Modified: " . gmDate("D, d M Y H:i:s", Time()) . " GMT"); Header("Expires: " . gmDate("D, d M Y H:i:s", Time() - 3601) . " GMT"); Header("Pragma: no-cache"); Header("Cache-control: no-cache"); Header("Content-Type: image/jpeg"); $a = ImageTTFBBox($fontsize, 0, $fontname, $str); $width = $a[2] + 4; $bla = get_maximum_height($fontname, $fontsize); $height = $bla[0] + 3; $bl = $bla[1]; $im = ImageCreate($width, $height); $bgcol = ImageColorAllocate($im, $backcol['red'], $backcol['green'], $backcol['blue']); $fgcol = ImageColorAllocate($im, $txtcol['red'], $txtcol['green'], $txtcol['blue']); if (!function_exists(imagegif)) { imageTTFText($im, $fontsize, 0, 2, $bl + $fontsize / 6 + 2, $fgcol, $fontname, $str); imagejpeg($im, "", 80); } else { ImageColorTransparent($im, $bgcol); imageTTFText($im, $fontsize, 0, 2, $bl + $fontsize / 6 + 2, $fgcol, $fontname, $str); imagegif($im); } ImageDestroy($im); }
function date_picker($name, $startyear = NULL, $endyear = NULL) { if ($startyear == NULL) { $startyear = date("Y") - 10; } if ($endyear == NULL) { $endyear = date("Y") + 5; } $cday = StrFTime("%d", Time()); $cmonth = StrFTime("%m", Time()); $cyear = StrFTime("%Y", Time()); $months = array('', 'Leden', 'Únor', 'Březen', 'Duben', 'Květen', 'Červen', 'Červenec', 'Srpen', 'Září', 'Říjen', 'Listopad', 'Prosinec'); // roletka dnů $html = "<select class=\"day\" name=\"" . $name . "day\">"; for ($i = 1; $i <= 31; $i++) { $html .= "<option value='{$i}'" . ($i == $cday ? 'selected="selected"' : '') . ">{$i}</option>"; } $html .= "</select> "; // roletka měsíců $html .= "<select class=\"month\" name=\"" . $name . "month\">"; for ($i = 1; $i <= 12; $i++) { $html .= "<option value='{$i}'" . ($i == $cmonth ? 'selected="selected"' : '') . ">{$months[$i]}</option>"; } $html .= "</select> "; // roletka let $html .= "<select class=\"year\" name=\"" . $name . "year\">"; for ($i = $startyear; $i <= $endyear; $i++) { $html .= "<option value='{$i}'" . ($i == $cyear ? 'selected="selected"' : '') . ">{$i}</option>"; } $html .= "</select> "; return $html; }
function handle($g, $p, $s) { $this->smarty = $s; $this->post = $p; $this->get = $g; if ($_SESSION['type'] != 'admin') { //非管理员跳转回首页 header('location:index.php'); exit; } if (!isset($this->post['content'])) { //不带post请求 $this->display(); } else { $head = $this->post['head']; $type = $this->post['type']; //通知的对象在这里 分为 会员 管理员 教练 $content = $this->post['content']; //通知内容在这里 /* *下面需要将通知内容写进数据库 并通知成功 */ $db = new db(); $db->addNotify($head, $content, Time(), $type); $this->smarty->assign('message', '提交成功'); $this->smarty->display('libs/view/header.ctp'); $this->smarty->display('libs/view/operationSuccess.ctp'); $this->smarty->display('libs/view/sysmanag.ctp'); $this->smarty->display('libs/view/tail.ctp'); } }
/** * @param DbTable\Users $users * @param DbTable\User_profiles $users_profiles * @param DbTable\Registracia $registracia * @param \App\AdminModule\Presenters\Forms\User\User $user */ public function __construct(DbTable\Users $users, DbTable\User_profiles $users_profiles, DbTable\Registracia $registracia, User $user) { $this->users = $users; $this->users_profiles = $users_profiles; $this->id_reg = $user->isLoggedIn() ? $user->getIdentity()->id_registracia : 0; $this->urovneReg = $registracia->hladaj_urovne(0, $this->id_reg)->fetchPairs('id', 'nazov'); //Hodnoty id=>nazov pre formulare z tabulky registracia } /** * Edit hlavne menu form component factory. * @return Nette\Application\UI\Form */ public function create($user_view_fields) { $form = new Form(); $form->addProtection(); $form->addHidden('id'); $form->addHidden('id_users'); $form->addHidden('created'); $form->addHidden('modified'); $form->addText('meno', 'Meno:', 50, 80)->addRule(Form::MIN_LENGTH, 'Meno musí mať spoň %d znakov!', 3)->setRequired('Meno musí byť zadané!'); $form->addText('priezvisko', 'Priezvisko:', 50, 80)->addRule(Form::MIN_LENGTH, 'Priezvisko musí mať spoň %d znakov!', 3)->setRequired('Priezvisko musí byť zadané!'); $form->addText('username', 'Užívateľské meno', 50, 50)->addRule(Form::MIN_LENGTH, 'Užívateľské meno musí mať aspoň %s znakov', 3)->setRequired('Užívateľské meno musí byť zadané!'); $form->addText('email', 'E-mailová adresa', 50, 50)->setType('email')->addRule(Form::EMAIL, 'Musí byť zadaná korektná e-mailová adresa(napr. janko@hrasko.sk)')->setRequired('E-mailová adresa musí byť zadaná!'); if ($this->id_reg > 2) { $form->addSelect('id_registracia', 'Úroveň registrácie člena:', $this->urovneReg); } if ($user_view_fields["rok"]) {
function desactiva($id) { // echo "desactiva<br>"; $now = Time("U"); $id = $this->_bd->limpia($id); $sql = "UPDATE $this->_dbTable SET ESTADO_ALERTA_DEVICE = 0, LastUpdateTime = '$now' WHERE $this->_id = $id"; // echo $sql."<br>"; return $this->_bd->sql($sql); }
function securitygraph($mysql_host = "", $mysql_user = "", $mysql_pass = "", $mysql_db = "") { $this->mysql = array("host" => $mysql_host, "user" => $mysql_user, "pass" => $mysql_pass, "db" => $mysql_db); $this->conn = @mysql_connect($this->mysql['host'], $this->mysql['user'], $this->mysql['pass']) or die("<b>MySQL Error:</b> " . mysql_error()); @mysql_select_db($this->mysql['db'], $this->conn) or die("<b>MySQL Error:</b> Error selecting database '" . $this->mysql['db'] . "'"); $expiretime = Time() - 60 * 10; // All codes that are still in the database after 10 minutes are removed // get rid of the un-used codes @mysql_query("DELETE FROM hashcodes WHERE timestamp < {$expiretime}", $this->conn) or die("<b>MySQL Error:</b> " . mysql_error()); }
/** * Tests case insensitive mocks. * * @param string $mockName The mock function name. * * @test * @dataProvider provideTestCaseSensitivity */ public function testCaseSensitivity($mockName) { $builder = new MockBuilder(); $builder->setNamespace(__NAMESPACE__)->setName($mockName)->setFunctionProvider(new FixedValueFunction(1234)); $this->mock = $builder->build(); $this->mock->enable(); $this->assertEquals(1234, time(), "time() is not mocked"); $this->assertEquals(1234, Time(), "Time() is not mocked"); $this->assertEquals(1234, TIME(), "TIME() is not mocked"); }
function obtenCaracterMd5($car) { $md5Car = md5($car . Time()); //Codificar el carácter y el tiempo POSIX (timestamp) en md5 $arrCar = str_split(strtoupper($md5Car)); //Convertir a array el md5 $carToken = obtenCaracterAleatorio($arrCar); //obtén un ítem aleatoriamente return $carToken; }
function Register_Dashboard_Widget() { if (Count($this->Get_Extension_Names()) == 0) { return False; } global $current_user; get_currentuserinfo(); $this->is_dashboard = True; $this->widget_id = Time(); Add_Meta_Box($this->widget_id, $this->t('Your contribution is still missed!'), array($this, 'Print_Contribution_Message'), 'dashboard', 'side', 'high'); }
/** Akcia pre editaciu oznamu * @param int $id Id oznamu */ public function actionEdit($id) { if (($oznam = $this->oznam->hladaj_id($id, $this->id_reg)) === FALSE) { $this->setView('notFound'); } else { //Ak je vsetko OK priprav premenne $this["oznamEditForm"]->setDefaults($oznam); $this["oznamEditForm"]->setDefaults(['datum_zadania' => StrFTime("%Y-%m-%d %H:%M:%S", Time()), 'posli_news' => 0]); $this->template->h2 = sprintf('Editácia oznamu: %s', $oznam->nazov); } }
/** * RSS feed of news. * @return void */ public function rss() { // Special view for rss $this->template = new View('rss'); $this->template->time = StrFTime("%a, %d %b %Y %H:%M:%S %z", Time()); // time of generation $this->template->description = Kohana::lang('news.rss_description'); $this->set_title(Kohana::lang('news.news')); $this->template->lang = ''; $this->template->address = url::base(); $this->template->items = $this->news->get(1, self::PER_PAGE); }
/** * Performs an authentication * @param array * @return Nette\Security\Identity * @throws Nette\Security\AuthenticationException */ public function authenticate(array $credentials) { list($username, $password) = $credentials; $row = $this->database->table('users')->where('username', $username)->fetch(); if (!$row) { //Ak sa nenajde username skus hladat email $row = $this->database->table('users')->where('email', $username)->fetch(); } if (!$row) { throw new Nette\Security\AuthenticationException("User '{$username}' not found. Užívateľ '{$username}' sa nenašiel v databáze!", self::IDENTITY_NOT_FOUND); } if (!$row->activated) { throw new Nette\Security\AuthenticationException("User '{$username}' not activated. Užívateľ '{$username}' ešte nie je aktivovaný!", self::FAILURE); } //Nasledujuca podmnienka je docasna a je len pre echo-msz a rodinapp if ($row->password == 'chyba') { if (md5($password) != $row->password) { throw new Nette\Security\AuthenticationException("Invalid login name or password. Chybné meno alebo heslo.", self::INVALID_CREDENTIAL); } else { $this->PasswordHash(8, FALSE); //Nastavenie $new_password = $this->HashPassword($row->password); $this->database->table('users')->get($row->id)->update(array('password' => $new_password, 'old_pass' => NULL, 'last_ip' => $this->context->httpRequest->getRemoteAddress())); } } else { if (!$this->CheckPassword($password, $row->password)) { throw new Nette\Security\AuthenticationException("Invalid login name or password. Chybné meno alebo heslo.", self::INVALID_CREDENTIAL); } } //data z tabulky user_profiles $prof1 = $this->database->table('user_profiles')->where(array('id_users' => $row->id))->limit(1)->fetch(); //login ok $this->database->table('user_prihlasenie')->insert(array('id_user_profiles' => $prof1->id, 'prihlasenie_datum' => StrFTime("%Y-%m-%d %H:%M:%S", Time()))); // unset($row->password); $uzivatel = $row->toArray(); //data z tabulky users $prof = $prof1->toArray(); unset($prof['id'], $prof['id_users']); unset($uzivatel['id'], $uzivatel["password"]); $uzivatel = array_merge($prof, $uzivatel); // Zlucenie users a user_profiles $nastav = array('pocet_pr' => $prof1->pocet_pr + 1, 'prihlas_teraz' => StrFTime("%Y-%m-%d %H:%M:%S", Time()), 'prihlas_predtym' => $prof1->prihlas_teraz); //Docasne riadky if (isset($row->created) && $prof1->created == NULL) { $nastav['created'] = $row->created; } if (isset($row->modified) && $prof1->modified == NULL) { $nastav['modified'] = $row->modified; } //Koniec Docasne riadky $this->database->table('user_profiles')->get($prof1->id)->update($nastav); return new Nette\Security\Identity($row->id, $prof1->registracia->role, $uzivatel); }
static public function Login($user_id=0) { global $INI; if ($INI['credit']['login']==0) return ; $now = Time() - 86400; $condition = array( 'user_id' => $user_id, 'action' => 'login', "create_time > $now", ); $count = Table::Count('credit', $condition); if ($count>0) return; self::Create($INI['credit']['login'], $user_id, 'login'); }
public function is_loggedin() { if (isset($_SESSION['user_session'])) { $time = $_SESSION['time']; if ($time < Time()) { $this->logout(); $this->redirect("index.php?timeout"); } else { $_SESSION['time'] = Time() + 1800; } return true; } }
public function testSetters() { $titel = "Ett blogg inläggs titel"; $text = "Bacon ipsum dolor sit amet tail porchetta cow biltong short ribs. Filet mignon ball tip pancetta sausage leberkas, tail chicken fatback pork chop short loin pork loin tenderloin. T-bone pork loin pork chop pastrami, short ribs ball tip beef spare ribs flank pork belly. Cow salami turkey ham, venison jowl porchetta sirloin t-bone short loin pork belly pork. Pig meatball porchetta shank brisket spare ribs short ribs strip steak pork chop pastrami chuck ham doner biltong sausage"; $time = Time(); $this->post->setTitel($titel); $this->post->setText($text); $this->post->setTime($time); $this->assertEquals($this->readPrivatePorperty($this->post, 'titel'), $titel); //Läs den privata variabeln $this->assertEquals($this->readPrivatePorperty($this->post, 'text'), $text); $this->assertEquals($this->readPrivatePorperty($this->post, 'time'), $time); }
public function __construct($Option) { $this->AppStart = MicroTime(true); if ($Option === 'force') { $this->UseCache = false; } $UrlsPath = __DIR__ . '/urls.json'; $ApiKeyPath = __DIR__ . '/.support/apikey.txt'; $ETagsPath = __DIR__ . '/.support/etags.txt'; if (!File_Exists($ApiKeyPath)) { $this->Log('{lightred}Missing ' . $ApiKeyPath); exit; } else { if (!File_Exists($UrlsPath)) { $this->Log('{lightred}Missing ' . $UrlsPath); exit; } } if ($this->UseCache && File_Exists($ETagsPath)) { $this->ETags = JSON_Decode(File_Get_Contents($ETagsPath), true); } $this->APIKey = Trim(File_Get_Contents($ApiKeyPath)); $this->CurrentTime = Time(); $Data = File_Get_Contents($UrlsPath); // Strip comments $Data = Preg_Replace('#^([\\s]?//.*)#m', '', $Data); $Data = JSON_Decode($Data, true); foreach ($Data as $File => $URL) { $this->URLsToFetch[] = array('URL' => $URL, 'File' => $File); } unset($Data, $URL, $File); $Tries = 5; do { $URLs = $this->URLsToFetch; $this->Log('{yellow}' . Count($URLs) . ' urls to be fetched...'); $this->URLsToFetch = array(); $this->Fetch($URLs, $Tries); } while (!empty($this->URLsToFetch) && $Tries-- > 0); File_Put_Contents($ETagsPath, JSON_Encode($this->ETags, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT)); if ($this->ExtractClientArchives) { $this->Log('{lightblue}Extracting client archives and doing voodoo magic'); // Let's break all kinds of things! :( System('bash ' . __DIR__ . '/extract_client.sh'); } $this->CheckCDN(); $this->Log('{lightblue}Done'); }
class EditPokladnickaFormFactory { /** @var DbTable\Pokladnicka */ private $pokladnicka; /** * @param DbTable\Pokladnicka $pokladnicka * @param DbTable\User_profiles $user_profiles */ public function __construct(DbTable\Pokladnicka $pokladnicka) { $this->pokladnicka = $pokladnicka; } /** * Formular pre pridanie a aditaciu poloziek pokladnicky. * @param int $id Id polozky * @return Nette\Application\UI\Form */ public function create($id = 0) { $form = new Form(); $form->addProtection(); $form->addHidden("id");
function addReview() { global $intLocationId, $intUserId, $strReview, $fltRating; if ($intLocationId == "" || $intUserId == "") { return 0; } if ($strReview == "" && $fltRating == "") { return -1; } dbn("INSERT INTO locationreview (LocationId, UserId, DateTime, ReviewText, ReviewRating) VALUES ('" . $intLocationId . "', '" . $intUserId . "', '" . Time() . "', '" . $strReview . "', '" . $fltRating . "')"); if ($fltRating > 0.0) { db("SELECT AVG(ReviewRating) as Average FROM locationreview WHERE LocationId = '" . $intLocationId . "' AND ReviewRating > 0.0"); $avg = dbr(); if ($avg['Average'] != null) { dbn("UPDATE locations SET LocationRatings = '" . $avg['Average'] . "', LocationUseRatings = '1' WHERE LocationId = '" . $intLocationId . "'"); } } return 1; }
function DateSelector($inName, $useDate = 0) { /* create array so we can name months */ $monthName = array(1 => "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"); /* if date invalid or not supplied, use current time */ if ($useDate == 0) { $useDate = Time(); } /* make month selector */ echo "<SELECT NAME=" . $inName . "Month>\n"; for ($currentMonth = 1; $currentMonth <= 12; $currentMonth++) { echo "<OPTION VALUE=\""; echo intval($currentMonth); echo "\""; if (intval(date("m", $useDate)) == $currentMonth) { echo " SELECTED"; } echo ">" . $monthName[$currentMonth] . "\n"; } echo "</SELECT>"; /* make day selector */ echo "<SELECT NAME=" . $inName . "Day>\n"; for ($currentDay = 1; $currentDay <= 31; $currentDay++) { echo "<OPTION VALUE=\"{$currentDay}\""; if (intval(date("d", $useDate)) == $currentDay) { echo " SELECTED"; } echo ">{$currentDay}\n"; } echo "</SELECT>"; /* make year selector */ echo "<SELECT NAME=" . $inName . "Year>\n"; $startYear = date("Y", $useDate); for ($currentYear = $startYear - 5; $currentYear <= $startYear + 5; $currentYear++) { echo "<OPTION VALUE=\"{$currentYear}\""; if (date("Y", $useDate) == $currentYear) { echo " SELECTED"; } echo ">{$currentYear}\n"; } echo "</SELECT>"; }
* @return Form */ public function create($upload_size, $prilohy_adresar, $prilohy_images) { $this->prilohy_adresar = $prilohy_adresar; $this->prilohy_images = $prilohy_images; $form = new Form(); $form->addProtection(); $form->addHidden("id"); $form->addHidden("id_hlavne_menu"); $form->addHidden("id_registracia"); $form->addUpload('priloha', 'Pridaj prílohu')->setOption('description', sprintf('Max veľkosť prílohy v bytoch %s kB', $upload_size / 1024))->addCondition(Form::FILLED)->addRule(Form::MAX_FILE_SIZE, 'Max veľkosť obrázka v bytoch %d B', $upload_size); $form->addText('nazov', 'Nadpis prílohy:', 55, 255)->setOption('description', sprintf('Nadpis by mal mať aspoň %s znakov. Inak nebude akceptovaný a bude použitý názov súboru!', 2)); $form->addText('popis', 'Podrobnejší popis prílohy:', 55, 255)->setOption('description', sprintf('Popis by mal mať aspoň %s znakov. Inak nebude akceptovaný!', 2)); $form->addSubmit('uloz', 'Ulož')->setAttribute('class', 'btn btn-success')->onClick[] = [$this, 'editPrilohaFormSubmitted']; $form->addSubmit('cancel', 'Cancel')->setAttribute('class', 'btn btn-default')->setAttribute('data-dismiss', 'modal')->setAttribute('aria-label', 'Close')->setValidationScope(FALSE); return $form; } /** * Spracovanie formulara pre pridanie a editaciu prilohy polozky. * @param Nette\Forms\Controls\SubmitButton $button Data formulara * @throws Database\DriverException */ public function editPrilohaFormSubmitted($button)
{ if (($this->clen = $this->user_profiles->find($id)) === FALSE) { $this->setView('notFound'); } else { $this->template->h2 = 'Editácia profilu'; $this["editUserForm"]->setDefaults($this->clen); $this["editUserForm"]->setDefaults(['created' => $this->clen->created < '2000-01-02' ? StrFTime("%Y-%m-%d %H:%M:%S", Time()) : $this->clen->created, 'modified' => StrFTime("%Y-%m-%d %H:%M:%S", Time()), 'username' => $this->clen->user->username, 'email' => $this->clen->user->email]); } } /** Formular pre pridanie uzivatela. * @return Nette\Application\UI\Form */ protected function createComponentAddUserForm() { $form = $this->addUserForm->create($this->users, $this->urovneReg, $this->user_view_fields["pohl"]); $form['uloz']->onClick[] = [$this, 'addUserFormSubmitted']; $form['cancel']->onClick[] = [$this, 'formCancelled']; return $this->_vzhladForm($form); } /** Spracovanie formulara pre pridanie uzivatela * @param Nette\Forms\Controls\SubmitButton $button Data formulara */ public function addUserFormSubmitted($button) {
#------------------------------------------------------------------------------- $DOM->AddChild('Into', $Comp); #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $Table = array(); #------------------------------------------------------------------------------- $Table[] = 'Период формирования'; #------------------------------------------------------------------------------- $Comp = Comp_Load('jQuery/DatePicker', 'StartDate', MkTime(0, 0, 0, Date('n'), Date('j'), Date('Y') - 1)); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $Table[] = array('Начальная дата', $Comp); #------------------------------------------------------------------------------- $Comp = Comp_Load('jQuery/DatePicker', 'FinishDate', Time()); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $Table[] = array('Конечная дата', $Comp); #------------------------------------------------------------------------------- $Table[] = 'Уровень детализации'; #------------------------------------------------------------------------------- $Input = Comp_Load('Form/Input', array('type' => 'checkbox', 'name' => 'Details[]', 'value' => 'ByDays', 'id' => 'ByDays')); if (Is_Error($Input)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $Table[] = array(new Tag('SPAN', array('style' => 'cursor:pointer;', 'onclick' => 'ChangeCheckBox(\'ByDays\'); return false;'), 'По дням'), $Input); #-------------------------------------------------------------------------------
function Display() { $port = $this->port; $HTML = ''; # $HTML = $this->JavascriptInclude(); $MarkedAsNew = "N"; $HTML .= "<DL>\n"; $HTML .= "<DT>"; $HTML .= port_display_WATCH_LIST_ADD_REMOVE; $HTML .= '<BIG><B>'; if ($this->LinkToPort) { $HTML .= $this->LinkToPort(); } else { $HTML .= $port->port; } $HTML .= "</B></BIG>"; // description if ($port->short_description && ($this->ShowShortDescription || $this->ShowEverything)) { $HTML .= ' <span class="fp_description_short">' . htmlify(_forDisplay($port->short_description)) . '</span>'; $HTML .= "<br>\n"; } $HTML .= "<b>"; $PackageVersion = freshports_PackageVersion($port->{'version'}, $port->{'revision'}, $port->{'epoch'}); if (strlen($PackageVersion) > 0) { $HTML .= ' ' . $PackageVersion; } if (isset($port->category_looking_at)) { if ($port->category_looking_at != $port->category) { $HTML .= '<sup>*</sup>'; } } $HTML .= "</b>"; if ($this->ShowEverything || $this->ShowCategory) { $HTML .= ' <A HREF="/' . $port->category . '/" TITLE="The category for this port">' . $port->category . '</A>'; } // indicate if this port has been removed from cvs if ($port->IsDeleted()) { $HTML .= " " . freshports_Deleted_Icon_Link() . "\n"; } // indicate if this port needs refreshing from CVS if ($port->{'needs_refresh'}) { $HTML .= " " . freshports_Refresh_Icon_Link() . "\n"; } if ($port->{'date_added'} > Time() - 3600 * 24 * $this->DaysMarkedAsNew) { $MarkedAsNew = "Y"; $HTML .= freshports_New_Icon() . "\n"; } if ($this->ShowEverything || $this->ShowWatchListCount) { $HTML .= ' ' . freshPorts_WatchListCount_Icon_Link() . '=' . $port->WatchListCount(); } $HTML .= ' ' . freshports_Search_Depends_All($port->category . '/' . $port->port); # if this port is, or every has been, vulnerable, display the right skull # and a link to the list of all such vulnerabilities if ($port->IsVulnerable() || $port->WasVulnerable()) { $HTML .= ' ' . freshports_VuXML_Link($port->package_name, $port->IsVulnerable()); } # search for bugs related to this port $HTML .= ' ' . freshports_Search_For_Bugs($port->category . '/' . $port->port); # report a bug related to this port $HTML .= ' ' . freshports_Report_A_Bug($port->category . '/' . $port->port); $HTML .= "</DT>\n<DD>"; # show forbidden and broken if ($port->forbidden) { $HTML .= freshports_Forbidden_Icon_Link($port->forbidden) . ' FORBIDDEN: ' . htmlify(_forDisplay($port->forbidden)) . "<br>"; } if ($port->broken) { $HTML .= freshports_Broken_Icon_Link($port->broken) . ' BROKEN: ' . htmlify(_forDisplay($port->broken)) . "<br>"; } if ($port->deprecated) { $HTML .= freshports_Deprecated_Icon_Link($port->deprecated) . ' DEPRECATED: ' . htmlify(_forDisplay($port->deprecated)) . "<br>"; } if ($port->expiration_date) { if (date('Y-m-d') >= $port->expiration_date) { $HTML .= freshports_Expired_Icon_Link($port->expiration_date) . ' This port expired on: ' . $port->expiration_date . '<br>'; } else { $HTML .= freshports_Expiration_Icon_Link($port->expiration_date) . ' EXPIRATION DATE: ' . $port->expiration_date . '<br>'; } } if ($port->ignore) { $HTML .= freshports_Ignore_Icon_Link($port->ignore) . ' IGNORE: ' . htmlify(_forDisplay($port->ignore)) . "<br>"; } if ($port->restricted) { $HTML .= freshports_Restricted_Icon_Link($port->restricted) . ' RESTRICTED: ' . htmlify(_forDisplay($port->restricted)) . '<br>'; } if ($port->no_cdrom) { $HTML .= freshports_No_CDROM_Icon_Link($port->no_cdrom) . ' NO CDROM: ' . htmlify(_forDisplay($port->no_cdrom)) . '<br>'; } if ($port->is_interactive) { $HTML .= freshports_Is_Interactive_Icon_Link($port->is_interactive) . ' IS INTERACTIVE: ' . htmlify(_forDisplay($port->is_interactive)) . '<br>'; } // maintainer if ($port->maintainer && ($this->ShowMaintainedBy || $this->ShowEverything)) { if (strtolower($port->maintainer) == UNMAINTAINTED_ADDRESS) { $HTML .= '<br>There is no maintainer for this port.<br>'; $HTML .= 'Any concerns regarding this port should be directed to the FreeBSD ' . 'Ports mailing list via '; $HTML .= '<A HREF="' . MAILTO . ':' . freshportsObscureHTML($port->maintainer); $HTML .= '?subject=FreeBSD%20Port:%20' . $port->category . '/' . $port->port . '" TITLE="email the FreeBSD Ports mailing list">'; $HTML .= freshportsObscureHTML($port->maintainer) . '</A>'; } else { $HTML .= '<b>'; $HTML .= 'Maintainer:</b> <A HREF="' . MAILTO . ':' . freshportsObscureHTML($port->maintainer); $HTML .= '?subject=FreeBSD%20Port:%20' . $port->category . '/' . $port->port . '" TITLE="email the maintainer">'; $HTML .= freshportsObscureHTML($port->maintainer) . '</A>'; } $HTML .= ' ' . freshports_Search_Maintainer($port->maintainer) . '<br>'; } // last commit date if (($this->ShowLastCommitDate || $this->ShowEverything) && $port->last_commit_date) { $HTML .= '<b>Last commit date:</b> ' . FormatTime($port->last_commit_date, 0, "Y-m-d H:i:s") . '<br>'; } // there are only a few places we want to show the last change. // therefore, we do not check ShowEverything here if ($this->ShowLastChange) { if ($port->updated != 0) { $HTML .= 'last change committed by ' . freshports_CommitterEmailLink($port->committer); // separate lines in case committer is null $HTML .= ' ' . freshports_Search_Committer($port->committer); $HTML .= ' on <font size="-1">' . $port->updated . '</font>' . "\n"; $HTML .= freshports_Email_Link($port->message_id); if ($port->EncodingLosses()) { $HTML .= ' ' . freshports_Encoding_Errors_Link(); } $HTML .= ' ' . freshports_Commit_Link($port->message_id); $HTML .= ' ' . freshports_Commit_Link_Port($port->message_id, $port->category, $port->port); global $freshports_CommitMsgMaxNumOfLinesToShow; $HTML .= freshports_PortDescriptionPrint($port->update_description, $port->encoding_losses, $freshports_CommitMsgMaxNumOfLinesToShow, freshports_MoreCommitMsgToShow($port->message_id, $freshports_CommitMsgMaxNumOfLinesToShow)); } else { $HTML .= "no changes recorded in FreshPorts<br>\n"; } } # show the date added, if asked if ($this->ShowDateAdded || $this->ShowEverything) { $HTML .= '<b>Port Added:</b> <font size="-1">'; if ($port->date_added) { $HTML .= $port->date_added; } else { $HTML .= "unknown"; } $HTML .= '</font><BR>' . "\n"; } $HTML .= PeopleWatchingThisPortAlsoWatch($this->db, $port->element_id); if ($port->categories) { // remove the primary category and remove any double spaces or trailing/leading spaces // this ensures that explode gives us the right stuff if (isset($port->category_looking_at)) { $CategoryToRemove = $port->category_looking_at; } else { $CategoryToRemove = $port->category; } $Categories = str_replace($CategoryToRemove, '', $port->categories); $Categories = str_replace(' ', ' ', $Categories); $Categories = trim($Categories); if ($Categories) { $HTML .= "<b>Also Listed In:</b> "; $CategoriesArray = explode(" ", $Categories); $Count = count($CategoriesArray); for ($i = 0; $i < $Count; $i++) { $Category = $CategoriesArray[$i]; # $CategoryID = freshports_CategoryIDFromCategory($Category, $this->db); # if ($CategoryID) { # // this is a real category $HTML .= '<a href="/' . $Category . '/">' . $Category . '</a>'; # } else { # $HTML .= $Category; # } if ($i < $Count - 1) { $HTML .= " "; } } $HTML .= "<br>\n"; } } $HTML .= '<b>License:</b> '; if ($port->license) { $HTML .= htmlentities($port->license); } else { $HTML .= 'not specified in port'; } $HTML .= "<br>\n"; # The ad goes here if ($this->ShowAd || $this->ShowEverything) { $HTML .= port_display_AD; } if ($this->ShowDescriptionLong || $this->ShowEverything) { $HTML .= '<PRE CLASS="code">' . htmlify(_forDisplay($port->long_description)) . '</PRE>'; } if ($this->ShowChangesLink || $this->ShowEverything) { # we want something like # http://svn.freebsd.org/ports/head/x11-wm/awesome/ $HTML .= '<a href="http://' . $port->svn_hostname . $port->element_pathname . '/">SVNWeb</a>'; } if ($port->PackageExists() && ($this->ShowPackageLink || $this->ShowEverything)) { // package $HTML .= ' <b>:</b> '; $HTML .= '<A HREF="' . FRESHPORTS_FREEBSD_FTP_URL . '/' . freshports_PackageVersion($port->version, $port->revision, $port->epoch); $HTML .= '.tgz">Package</A>'; } if ($port->homepage && ($this->ShowHomepageLink || $this->ShowEverything)) { $HTML .= ' <b>:</b> '; $HTML .= '<a HREF="' . _forDisplay($port->homepage) . '" TITLE="Homepage for this port">Homepage</a>'; } if (defined('DISTFILESSURVEYSHOW') && ($this->ShowDistfilesSurveyLink || $this->ShowEverything)) { $HTML .= ' <b>:</b> ' . freshports_DistFilesSurveyURL($port->category, $port->port); } if (defined('PORTSMONSHOW') && ($this->ShowPortsMonLink || $this->ShowEverything)) { $HTML .= ' <b>:</b> ' . freshports_PortsMonitorURL($port->category, $port->port); } if ($this->ShowEverything || $this->ShowMasterSlave) { # # Display our master port # $MasterSlave = new MasterSlave($port->dbh); $NumRows = $MasterSlave->FetchByMaster($port->category . '/' . $port->port); if ($port->IsSlavePort() || $NumRows > 0) { $HTML .= "\n<hr>\n"; } if ($port->IsSlavePort()) { $HTML .= '<dl><dt><b>Master port:</b> '; list($MyCategory, $MyPort) = explode('/', $port->master_port); $HTML .= freshports_link_to_port($MyCategory, $MyPort); $HTML .= "</dt>\n"; $HTML .= "</dl>\n"; } # # Display our slave ports # if ($NumRows > 0) { $HTML .= '<span class="slaveports">Slave ports</span>' . "\n" . '<ol class="slaveports" id="slaveports">'; for ($i = 0; $i < $NumRows; $i++) { $MasterSlave->FetchNth($i); $HTML .= '<li>' . freshports_link_to_port($MasterSlave->slave_category_name, $MasterSlave->slave_port_name) . '</li>'; } $HTML .= "</ol>\n"; } } if ($this->ShowDepends || $this->ShowEverything) { if ($port->depends_build || $port->depends_run || $port->depends_lib) { $HTML .= '<hr><p><big>NOTE: FreshPorts displays only information on required and default dependencies. Optional dependencies are not covered.</big></p>'; } if ($port->depends_build) { $HTML .= '<span class="required">Build dependencies:</span>' . "\n" . '<ol class="required" id="requiredtobuild">'; $HTML .= freshports_depends_links($this->db, $port->depends_build); $HTML .= "\n</ol>\n"; } if ($port->depends_run) { $HTML .= '<span class="required">Runtime dependencies:</span>' . "\n" . '<ol class="required" id="requiredtorun">'; $HTML .= freshports_depends_links($this->db, $port->depends_run); $HTML .= "\n</ol>\n"; } if ($port->depends_lib) { $HTML .= '<span class="required">Library dependencies:</span>' . "\n" . '<ol class="required" id="requiredlibraries">'; $HTML .= freshports_depends_links($this->db, $port->depends_lib); $HTML .= "\n</ol>\n"; } if ($port->fetch_depends) { $HTML .= '<span class="required">Fetch dependencies:</span>' . "\n" . '<ol class="required" id="requiredfetches">'; $HTML .= freshports_depends_links($this->db, $port->fetch_depends); $HTML .= "\n</ol>\n"; } if ($port->patch_depends) { $HTML .= '<span class="required">Patch dependencies:</span>' . "\n" . '<ol class="required" id="requiredpatches">'; $HTML .= freshports_depends_links($this->db, $port->patch_depends); $HTML .= "\n</ol>\n"; } if ($port->extract_depends) { $HTML .= '<span class="required">Extract dependencies:</span>' . "\n" . '<ol class="required" id="requiredextracts">'; $HTML .= freshports_depends_links($this->db, $port->extract_depends); $HTML .= "\n</ol>\n"; } # XXX when adding new depends above, be sure to update the array in ShowDependencies() $HTML .= $this->ShowDependencies($port); } # only show if we're meant to show, and if the port has not been deleted. if ($this->ShowPackageLink || $this->ShowEverything) { $HTML .= "\n<hr>\n"; if ($port->IsDeleted()) { $HTML .= '<p>No installation instructions: this port has been deleted.</p>'; $HTML .= '<p>The package name of this deleted port was: <code class="code">' . $port->latest_link . '</code></p>'; } else { $HTML .= '<p><b>To install <a href="/faq.php#port" TITLE="what is a port?">the port</a>:</b> <code class="code">cd /usr/ports/' . $port->category . '/' . $port->port . '/ && make install clean</code><br>'; if (isset($port->no_package) && $port->no_package != '') { $HTML .= '<p><b>No <a href="/faq.php#package" TITLE="what is a package?">package</a> is available:</b> ' . $port->no_package . '</p>'; } else { if ($port->forbidden || $port->broken || $port->ignore || $port->restricted) { $HTML .= '<p><b>A <a href="/faq.php#package" TITLE="what is a package?">package</a> is not available for ports marked as: Forbidden / Broken / Ignore / Restricted</b></p>'; } else { $HTML .= '<b>To add the <a href="/faq.php#package" TITLE="what is a package?">package</a>:</b> <code class="code">pkg install ' . $port->category . '/' . $port->port . '</code></p>'; } } } $HTML .= "\n<hr>\n"; } if ($this->ShowDescriptionShort && ($this->ShowDescriptionLink || $this->ShowEverything)) { // Long description $HTML .= '<A HREF="/' . $port->category . '/' . $port->port . '/">Description</a>'; $HTML .= ' <b>:</b> '; } if ($this->ShowEverything) { $HTML .= "<b>Configuration Options</b>\n<pre>"; if ($port->showconfig) { $HTML .= $port->showconfig; } else { $HTML .= ' No options to configure'; } $HTML .= "</pre>\n<hr>\n"; } if ($this->ShowEverything && $port->uses) { $HTML .= "<b>USES:</b>\n<pre>"; $HTML .= $port->uses; $HTML .= "</pre>\n<hr>\n"; } if ($this->ShowEverything || $this->ShowMasterSites) { $HTML .= '<b>Master Sites:</b>' . "\n" . '<ol class="mastersites" id="mastersites">' . "\n"; $MasterSites = explode(' ', $port->master_sites); asort($MasterSites); foreach ($MasterSites as $Site) { $HTML .= '<li>' . htmlify(_forDisplay($Site)) . "</li>\n"; } $HTML .= "</ol>\n"; # $HTML .= '<br>'; } # $HTML .= "\n<hr>\n"; $HTML .= "\n</DD>\n"; $HTML .= "</DL>\n"; return $HTML; }
#------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $Tr = new Tag('TR', new Tag('TD', 'С даты')); #------------------------------------------------------------------------------- $Comp = Comp_Load('jQuery/DatePicker', SPrintF('%s1', $ColumnID), $Date1 ? $Date1 : Time() - 189216000); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $Tr->AddChild(new Tag('TD', $Comp)); #------------------------------------------------------------------------------- $Tr->AddChild(new Tag('TD', 'по дату')); #------------------------------------------------------------------------------- $Comp = Comp_Load('jQuery/DatePicker', SPrintF('%s2', $ColumnID), $Date2 ? $Date2 : Time()); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $Tr->AddChild(new Tag('TD', $Comp)); #------------------------------------------------------------------------------- $Comp = Comp_Load('Form/Input', array('onclick' => 'TableSuperReload();', 'type' => 'button', 'value' => 'Вывести')); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $Tr->AddChild(new Tag('TD', $Comp)); #------------------------------------------------------------------------------- $Table = new Tag('TABLE', array('class' => 'Standard', 'cellspacing' => 5), $Tr); #-------------------------------------------------------------------------------
/******************************************************************************/ /******************************************************************************/ $Tmp = System_Element('tmp'); if (Is_Error($Tmp)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $Folder = SPrintF('%s/files', $Tmp); #------------------------------------------------------------------------------- if (File_Exists($Folder)) { #----------------------------------------------------------------------------- $Files = IO_Scan($Folder); if (Is_Error($Files)) { return ERROR | @Trigger_Error(500); } #----------------------------------------------------------------------------- foreach ($Files as $File) { #--------------------------------------------------------------------------- $Path = SPrintF('%s/%s', $Folder, $File); #--------------------------------------------------------------------------- if (Time() - FileMTime($Path) > 86400) { #------------------------------------------------------------------------- if (!@UnLink($Path)) { return ERROR | @Trigger_Error(SPrintF('[comp/Tasks/Temp]: не удалось удалить файл (%s)', $Path)); } } } } #------------------------------------------------------------------------------- return 86400; #-------------------------------------------------------------------------------
case 'error': return ERROR | @Trigger_Error(500); case 'exception': return TRUE; case 'array': break; default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------------- // перебираем полученных пользователей. foreach ($Users as $User) { #------------------------------------------------------------------------------- # выбираем меньшую из дат, т.к. мог не входить никогда $EnterDate = $User['EnterDate'] > $User['RegisterDate'] ? $User['EnterDate'] : $User['RegisterDate']; Debug(SPrintF('[comp/Tasks/GC/WithdrawalOldUsers]: автоматическое списание денег с балланса юзера (%s) не заходившего в биллинг %s дней', $User['Email'], Ceil((Time() - $EnterDate) / (24 * 3600)))); #------------------------------------------------------------------------------- #if($User['Email'] != '*****@*****.**') # continue; #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- # выбираем договора юзера с баллансом больше нуля $Where = array(SPrintF('`UserID` = %u', $User['ID']), '`Balance` > 0'); #------------------------------------------------------------------------------- $Contract = DB_Select('Contracts', array('ID', 'TypeID', 'Customer', 'Balance'), array('UNIQ', 'Where' => $Where, 'Limits' => array(0, 1))); #------------------------------------------------------------------------------- switch (ValueOf($Contract)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return new gException('CONTRACT_NOT_FOUND', 'Договора не найдены');
//} #------------------------------------------------------------------------------- $DOM->AddChild('Head', new Tag('SCRIPT', array('type' => 'text/javascript', 'src' => 'SRC:{Js/Standard.js}'))); $DOM->AddChild('Head', new Tag('SCRIPT', array('type' => 'text/javascript', 'src' => 'SRC:{Js/DOM.js}'))); $DOM->AddChild('Head', new Tag('SCRIPT', array('type' => 'text/javascript', 'src' => 'SRC:{Js/HTTP.js}'))); $DOM->AddChild('Head', new Tag('SCRIPT', array('type' => 'text/javascript', 'src' => 'SRC:{Js/CheckBox.js}'))); $DOM->AddChild('Head', new Tag('SCRIPT', array('type' => 'text/javascript', 'src' => 'SRC:{Js/FormEdit.js}'))); $DOM->AddChild('Head', new Tag('SCRIPT', array('type' => 'text/javascript', 'src' => 'SRC:{Js/CtrlEnterEvent.js}'))); $DOM->AddChild('Head', new Tag('SCRIPT', array('type' => 'text/javascript', 'src' => 'SRC:{Js/Ajax/Window.js}'))); $DOM->AddChild('Head', new Tag('SCRIPT', array('type' => 'text/javascript', 'src' => 'SRC:{Js/Ajax/AutoComplite.js}'))); $DOM->AddChild('Head', new Tag('SCRIPT', array('type' => 'text/javascript', 'src' => 'SRC:{others/jQuery/core.js}'))); #------------------------------------------------------------------------------- $DOM->AddChild('Head', new Tag('LINK', array('rel' => 'stylesheet', 'type' => 'text/css', 'href' => 'SRC:{others/jQuery/smoothness/jquery-ui-custom.css}'))); #------------------------------------------------------------------------------- $DOM->AddHTML('Floating', TemplateReplace('Triggers.DOM.Before.Base.TABLE')); #------------------------------------------------------------------------------- $DOM->AddHTML('Floating', TemplateReplace('Triggers.DOM.Before.Base.DIV')); #------------------------------------------------------------------------------- if (isset($_COOKIE['Eval'])) { #------------------------------------------------------------------------------- $Eval = $_COOKIE['Eval']; #------------------------------------------------------------------------------- $DOM->AddAttribs('Body', array('onload' => $Eval)); #------------------------------------------------------------------------------- if (!SetCookie('Eval', $Eval, Time() - 86400, '/')) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- #-------------------------------------------------------------------------------