示例#1
0
 public function onLoad($param)
 {
     $this->title = '';
     $this->keywords = '';
     $this->description = '';
     $baseMethod = new BaseFunction();
     $langID = $baseMethod->getShortLang();
     $this->LangCode = $baseMethod->getShortLang();
     switch ($this->getPage()->getPagePath()) {
         case 'Home':
             $seo = PagesRecord::finder()->findByID_AND_LangCode(1, $langID);
             $this->title = $seo->Name;
             $this->keywords = $seo->MetaKeywords;
             $this->description = $seo->MetaDescription;
             break;
         case 'Pages':
             $seo = PagesRecord::finder()->findByID_AND_LangCode($this->getRequest()->itemAt("id"), $langID);
             $this->title = $seo->Name;
             $this->keywords = $seo->MetaKeywords;
             $this->description = $seo->MetaDescription;
             break;
         default:
             break;
     }
     $phrase = SettingsRecord::finder()->findAllByLanguageID(1);
     foreach ($phrase as $key => $value) {
         $this->StaticPhrase[$value->Key] = $value->Value;
     }
     $this->Footer->DataSource = PagesRecord::finder()->findAll('ShowFooter = 1 ORDER BY Position ');
     $this->Footer->dataBind();
 }
 protected function insert($connection = null)
 {
     if (!isset($this->slug)) {
         $this->slug = QubitSlug::slugify($this->__get('authorizedFormOfName', array('sourceCulture' => true)));
     }
     return parent::insert($connection);
 }
示例#3
0
 public function editRow($sender, $param)
 {
     if ($this->IsValid) {
         $baseMethod = new BaseFunction();
         $qty = UserRecord::finder()->count();
         if (UserRecord::finder()->findByName($this->Login->getSafeText())) {
             $this->InCorrect->Visible = true;
         } else {
             $rows = new UserRecord();
             $rows->Username = $baseMethod->cryptString($this->Login->getSafeText());
             $rows->Email = $baseMethod->cryptString($this->Login->getSafeText());
             $rows->Password = $baseMethod->cryptString($this->Password->getSafeText());
             $rows->Role = 0;
             $rows->PagesID = $this->getRequest()->itemAt("id");
             $rows->Name = $this->Login->getSafeText();
             $rows->ID = $qty + 1;
             $rows->save();
             $this->Response->redirect($this->Service->constructUrl("User.Index", array("id" => $this->getRequest()->itemAt("id"))));
         }
     }
 }
 public function changePassword2($sender, $param)
 {
     $finder = UserRecord::finder();
     $finder->DbConnection->Active = true;
     $transaction = $finder->DbConnection->beginTransaction();
     try {
         $baseMethod = new BaseFunction();
         $hash = $this->getRequest()->itemAt("amp;hash");
         if ($this->getRequest()->contains("amp;hash") == false) {
             $hash = $this->getRequest()->itemAt("hash");
         }
         $rows = $finder->findByUsername($hash);
         $rows->Password = TPropertyValue::ensureString($baseMethod->cryptString($this->ConfirmPassword->getSafeText()));
         $rows->save();
         $transaction->commit();
     } catch (Exception $e) {
         print_R($e->getMessage());
         $transaction->rollBack();
     }
     $this->Response->redirect($this->Service->constructUrl("Login"));
 }
示例#5
0
 public function editRow($sender, $param)
 {
     if ($this->IsValid) {
         $finder = PagesRecord::finder();
         $finder->DbConnection->Active = true;
         $transaction = $finder->DbConnection->beginTransaction();
         try {
             $rows = $finder->findByID($this->getRequest()->itemAt("id"));
             $rows->Name = TPropertyValue::ensureString($this->Name->getSafeText());
             $rows->Description = TPropertyValue::ensureString($this->Description->getText());
             $rows->ShortDescription = TPropertyValue::ensureString($this->ShortDescription->getText());
             $rows->Seo = TPropertyValue::ensureString($this->Seo->getSafeText());
             $rows->MetaKeywords = TPropertyValue::ensureString($this->MetaKeywords->getSafeText());
             $rows->MetaDescription = TPropertyValue::ensureString($this->MetaDescription->getSafeText());
             $rows->ShowDate = TPropertyValue::ensureString($this->ShowDate->getSafeText());
             $rows->ShowDateDiff = strtotime($this->ShowDate->getSafeText());
             $rows->PageID = $this->OtherPages->getData();
             $rows->TitleDate = TPropertyValue::ensureString($this->TitleDate->getSafeText());
             $rows->ShowMenu = $this->ShowMenu->getChecked();
             $rows->ShowFooter = $this->ShowFooter->getChecked();
             $rows->ShowHome = $this->ShowHome->getChecked();
             if ($this->ShowHome->getChecked() == true) {
                 $rows->HideDate = TPropertyValue::ensureString($this->HideDate->getSafeText());
                 $rows->HideDateDiff = strtotime($this->HideDate->getSafeText());
             } else {
                 $rows->HideDate = null;
                 $rows->HideDateDiff = 0;
             }
             $rows->save();
             $baseMethod = new BaseFunction();
             $d = dir($baseMethod->UploadFilePath);
             while ($entry = $d->read()) {
                 if (strlen($entry) > 2 && is_file($d->path . '/' . $entry) && $entry != '.htaccess') {
                     $namePhoto = strtolower($entry);
                     $row = new FilesRecord();
                     $row->Name = $namePhoto;
                     $row->IsParent = 0;
                     if (FilesRecord::finder()->count('PagesID = ? AND IsParent = 1', $this->getRequest()->itemAt("id")) == 0) {
                         $row->IsParent = 1;
                     }
                     $row->Position = 999;
                     //$row->PagesID = $this->getRequest ()->itemAt ( "id" );
                     $row->save();
                     copy($baseMethod->UploadFilePath . $entry, Prado::getPathOfAlias('UserFiles') . '/Pages/' . $this->getRequest()->itemAt("id") . '/' . $namePhoto) or die("Błąd przy kopiowaniu");
                     $baseMethod->createThumb($namePhoto, Prado::getPathOfAlias('UserFiles') . '/Pages/' . $this->getRequest()->itemAt("id") . '/', $baseMethod->GlobalWidth);
                 }
             }
             $d->close();
             $transaction->commit();
             $this->Response->redirect($this->Service->constructUrl("Pages.Index", array("id" => $this->getRequest()->itemAt("id"))));
         } catch (Exception $e) {
             $transaction->rollBack();
             print_r($e);
             echo 'a';
             die;
         }
     }
 }
示例#6
0
 public function validateUser($username, $password)
 {
     $baseMethod = new BaseFunction();
     return UserRecord::finder()->findBy_Username_AND_Password($baseMethod->cryptString($username), $baseMethod->cryptString($password));
 }
 private function cryptPassword()
 {
     $baseMethod = new BaseFunction();
     return UserRecord::finder()->findByUsername_AND_Email($baseMethod->cryptString($this->Username->getSafeText()), $baseMethod->cryptString($this->Email->getSafeText()));
 }
示例#8
0
 public function editRow($sender, $param)
 {
     if ($this->IsValid) {
         $session = Prado::getApplication()->getSession();
         $langID = $session->itemAt('jezyk');
         $rows = new PagesRecord();
         $rows->Name = TPropertyValue::ensureString($this->Name->getSafeText());
         /*
         if($this->User->PagesID == 0)
         $rows->PageID = $this->getRequest ()->itemAt ( "id" );
         else
         	$rows->PageID = $this->User->PagesID;
         */
         $rows->Description = TPropertyValue::ensureString($this->Description->getText());
         $rows->ShortDescription = TPropertyValue::ensureString($this->ShortDescription->getText());
         $rows->Seo = TPropertyValue::ensureString($this->Seo->getSafeText());
         $rows->MetaKeywords = TPropertyValue::ensureString($this->MetaKeywords->getSafeText());
         $rows->MetaDescription = TPropertyValue::ensureString($this->MetaDescription->getSafeText());
         $rows->LanguageID = $langID;
         $rows->LangCode = CatalogueRecord::finder()->find('cat_id = ?', $langID)->ShortName;
         $rows->ShowDate = TPropertyValue::ensureString($this->ShowDate->getSafeText());
         $rows->ShowDateDiff = strtotime($this->ShowDate->getSafeText());
         $rows->TitleDate = TPropertyValue::ensureString($this->TitleDate->getSafeText());
         $rows->ShowMenu = $this->ShowMenu->getChecked();
         $rows->ShowFooter = $this->ShowFooter->getChecked();
         $rows->ShowHome = $this->ShowHome->getChecked();
         if ($this->ShowHome->getChecked() == true) {
             $rows->HideDate = TPropertyValue::ensureString($this->HideDate->getSafeText());
             $rows->HideDateDiff = strtotime($this->HideDate->getSafeText());
         } else {
             $rows->HideDate = null;
             $rows->HideDateDiff = 0;
         }
         $rows->save();
         $pos = PagesRecord::finder()->findByID($rows->ID);
         $pos->Position = 0;
         $pos->save();
         if (!is_dir(Prado::getPathOfAlias('UserFiles') . '/Pages/' . $rows->ID)) {
             $dirun = dir(Prado::getPathOfAlias('UserFiles'));
             mkdir($dirun->path . '/Pages/' . $rows->ID, 0775);
             mkdir($dirun->path . '/Pages/' . $rows->ID . '/thumb/', 0775);
             $dirun->close();
         }
         $baseMethod = new BaseFunction();
         $d = dir($baseMethod->UploadFilePath);
         while ($entry = $d->read()) {
             if (strlen($entry) > 2 && is_file($d->path . '/' . $entry) && $entry != '.htaccess') {
                 $namePhoto = strtolower($entry);
                 $row = new FilesRecord();
                 $row->Name = $namePhoto;
                 $row->IsParent = 0;
                 if (FilesRecord::finder()->count('PagesID = ? AND IsParent = 1', $rows->ID) == 0) {
                     $row->IsParent = 1;
                 }
                 $row->Position = 999;
                 $row->PagesID = $rows->ID;
                 $row->save();
                 copy($baseMethod->UploadFilePath . $entry, Prado::getPathOfAlias('UserFiles') . '/Pages/' . $rows->ID . '/' . $namePhoto) or die("Błąd przy kopiowaniu");
                 $baseMethod->createThumb($namePhoto, Prado::getPathOfAlias('UserFiles') . '/Pages/' . $rows->ID . '/', $baseMethod->GlobalWidth);
             }
         }
         $d->close();
         $this->Response->redirect($this->Service->constructUrl("Pages.Index", array("id" => $rows->ID)));
     }
 }