Example #1
0
 public function update($record)
 {
     if ($record['password']) {
         /*$salt = Bam_Functions::RandomId();
         		$type = 'sha1';
         		$hash = sha1("{$record['password']}{$salt}");
         		$record['passhash'] = $hash;
         		$record['salt'] = $salt;
         		$record['hashtype'] = $type;*/
         $record['auth'] = 'Hash';
         $record['hashtype'] = 'bcrypt';
         $prefix = '$2y$';
         $num = str_pad((string) rand(4, 10), 2, '0', STR_PAD_LEFT) . '$';
         $chars = Bam_Functions::RandomId(22);
         $record['salt'] = "{$prefix}{$num}{$chars}";
         $record['passhash'] = crypt($record['password'], $record['salt']);
     }
 }
Example #2
0
<?php

$article->setArray($_POST, false);
if (!empty($_POST['autosummary'])) {
    $article['autosummary'] = 1;
    $xml = Pagemill_SimpleXmlElement::LoadString($_POST['article']);
    if ($xml->p) {
        $summary = trim($xml->p[0]->innerXml());
    } else {
        $summary = trim(Bam_Functions::GetIntro($_POST['article']));
    }
    $article['summary'] = $summary;
} else {
    $article['autosummary'] = 0;
}
$article['image'] = basename(FileManager::GetPostedOrUploadedFile('image', TYPEF_DIR . '/files/public/news', 'jpg,jpeg,png,gif'));
if (FileManager::Error()) {
    $pm->addLoop('errors', array('message' => FileManager::Error()));
} else {
    $article->save();
}
Example #3
0
 /**
  * Decode field data from JSON format.
  * @param string|array $field The fields to encode.
  */
 public function __construct($fields)
 {
     $this->_fields = Bam_Functions::ListToArray($fields);
 }