Пример #1
0
 public function process()
 {
     if (!empty($this->value['tmp_name']) && !empty($this->value['name'])) {
         $result = basename(FileManager::GetPostedOrUploadedFile($this->_name, $this->_directory, 'jpg,jpeg,png,gif'));
         if (!FileManager::Error()) {
             $this->value = basename($result);
         } else {
             $this->error = 'Unable to upload ' . $this->label . ': ' . FileManager::Error();
         }
     } else {
         $this->value = '';
     }
 }
Пример #2
0
 public static function ProcessPost(&$inserts, &$groups)
 {
     $content = array();
     foreach ($inserts as $insert) {
         $key = $insert['name'];
         if ('image' == $insert['type']) {
             $value = basename(FileManager::GetPostedOrUploadedFile($key, TYPEF_DIR . '/files/public/content'));
         } elseif (isset($_POST[$key])) {
             $value = $_POST[$key];
         } else {
             $value = null;
         }
         $content[$key] = $value;
     }
     foreach ($groups as $group) {
         $key = $group['name'];
         $content[$key] = isset($_POST[$key]) ? Content::RecurseGroups($group, $_POST[$key]) : null;
     }
     return $content;
 }
Пример #3
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();
}
Пример #4
0
     } else {
         $skin = 'default';
     }
 } else {
     $skin = 'default';
 }
 $groups = Insertable::GroupsFrom($full_template, $matches[1], $skin);
 $group = $groups[0];
 // @todo Check permissions here?
 if ('POST' == $_SERVER['REQUEST_METHOD']) {
     if (isset($_POST['action']) && 'Cancel' != $_POST['action']) {
         $content = array();
         foreach ($group['members'] as $member) {
             $key = $member['name'];
             if ('image' == $member['type']) {
                 $value = basename(FileManager::GetPostedOrUploadedFile($key, TYPEF_DIR . '/files/public/content'));
             } elseif (isset($_POST[$key])) {
                 $value = $_POST[$key];
             } else {
                 $value = null;
             }
             $content[$key] = $value;
         }
         $pm->setVariable('row', $content);
         $pm->setVariable('group', $group);
     }
     Typeframe::SetPageTemplate('/admin/content/groups/form-post.html');
 }
 $pm->setVariable('action', $_SERVER['REQUEST_URI']);
 $pm->setVariable('group', $group);
 $pm->setVariable('template', $_REQUEST['template']);
Пример #5
0
<?php

$category->setArray($_POST, false);
$image = FileManager::GetPostedOrUploadedFile('categoryimage', TYPEF_DIR . '/files/public/news');
$category['categoryimage'] = basename($image);
if (!$category->exists()) {
    $ordered = new Model_News_Category();
    $ordered->where('parentid = 0');
    $ordered->order('sortnum DESC');
    $last = $ordered->getFirst();
    $category['sortnum'] = $last['sortnum'] + 1;
}
$category->save();