Beispiel #1
0
 function edit()
 {
     events::observe('save', 'templates', 'apps', '_save');
     events::observer();
     $tmpl_file = events::get('tmpl_file');
     $app = events::get('app');
     if (events::detect('restore')) {
         self::restoreVersion($app, $tmpl_file, events::get('restore'));
     }
     admin::components('tabs', 'validator');
     f::set('app', $app);
     f::set('tmpl_file', $tmpl_file);
     s::set('app', $app);
     s::set('tmpl_file', $tmpl_file);
     $file = SYS_ROOT . 'tmpls/' . ADMIN_SITE . '/' . $app . '/' . $tmpl_file;
     $code = files::get($file);
     f::set('tmpl_code', $code);
     self::getApps();
     /*
     	Load versions
     */
     db::table('templates_versions');
     db::where('app', $app);
     db::where('tmpl_file', $tmpl_file);
     db::order('version_date', 'DESC');
     $res = db::select();
     while ($row = mysql_fetch_assoc($res)) {
         $row['version_date'] = dt::date2print('%H:%i %d.%m.%Y', $row['version_date']);
         $row['version_code'] = '{non}' . htmlspecialchars($row['version_code']) . '{/non}';
         s::roll('versions', $row);
     }
 }
Beispiel #2
0
    return;
}
// stop crawlers
if (Surfer::is_crawler()) {
    Safe::header('Status: 401 Unauthorized', TRUE, 401);
    die(i18n::s('You are not allowed to perform this operation.'));
}
// some input is mandatory
if (!isset($_REQUEST['file']) && !isset($_REQUEST['target'])) {
    Safe::header('Status: 400 Bad Request', TRUE, 400);
    die(i18n::s('Request is invalid.'));
}
// préparation de la variable de sortie
$output = array('success' => null);
// get file to move
$file = new File(files::get($_REQUEST['file']));
// get target
$target = Anchors::get($_REQUEST['target']);
// check again
if (!isset($file->item) || !isset($target->item)) {
    Safe::header('Status: 400 Bad Request', TRUE, 400);
    die(i18n::s('Request is invalid.'));
}
// remember last parent
$last_parent = $file->anchor;
// check rights
if (!$file->is_assigned() || !$target->is_assigned()) {
    Safe::header('Status: 401 Unauthorized', TRUE, 401);
    die(i18n::s('You are not allowed to perform this operation.'));
}
// target may override work
Beispiel #3
0
 function adapter()
 {
     $adapter_file = APPS . self::$map['app'] . '/adapter.ini';
     $array = ini::parse($adapter_file);
     $action = self::$map['module'] . '.' . self::$map['action'];
     if (self::$apps_excl) {
         if (self::$map['app'] != 'system' || $action != 'profile.view') {
             if (!isset(self::$apps_excl[self::$map['app']][$action])) {
                 return self::loadErrorPage();
             }
         }
     }
     if (!$array) {
         return self::loadErrorPage();
     }
     if (!isset($array[$action])) {
         return self::loadErrorPage();
     }
     $mtabs = $tabs = false;
     foreach ($array as $k => $v) {
         if (isset($v['rule'])) {
             $rule = explode(',', $v['rule']);
             $continue = true;
             foreach ($rule as $u) {
                 $u = trim($u);
                 if ($u == RULE || $u == 'all') {
                     $continue = false;
                 }
             }
             if ($continue) {
                 continue;
             }
         }
         if (arrays::testKey($v, 'ico')) {
             $ico = 'tab_ico tab_ico_' . $v['ico'];
         } else {
             $ico = '';
         }
         if (arrays::testKey($v, 'mtab')) {
             $active = false;
             if ($action == $k) {
                 $active = true;
             }
             if ($v['mtab'] == 1) {
                 $name = $v['title'];
             } else {
                 $name = $v['mtab'];
             }
             $list = explode('.', $k);
             $link = SYS_DIR . self::$map['app'] . '/' . $list[0] . '/' . $list[1] . '/';
             if (isset($v['right'])) {
                 if ($active) {
                     $addtabs[$list[0]][] = array('tab' => '<span class="' . $ico . '">' . $name . '</span>');
                 } else {
                     $addtabs[$list[0]][] = array('tab' => '<a href="' . $link . '" class="' . $ico . '">' . $name . '</a>');
                 }
             } else {
                 if ($active) {
                     $mtabs[$list[0]][] = array('tab' => '<span class="' . $ico . '">' . $name . '</span>');
                 } else {
                     $mtabs[$list[0]][] = array('tab' => '<a href="' . $link . '" class="' . $ico . '">' . $name . '</a>');
                 }
             }
         } else {
             if (arrays::testKey($v, 'tab')) {
                 $active = false;
                 if ($action == $k) {
                     $active = true;
                 }
                 if ($v['tab'] == 1) {
                     $name = $v['title'];
                 } else {
                     $name = $v['tab'];
                 }
                 $list = explode('.', $k);
                 $link = SYS_DIR . self::$map['app'] . '/' . $list[0] . '/' . $list[1] . '/';
                 if (isset($v['right'])) {
                     if ($active) {
                         $addtabs[] = array('tab' => '<span class="' . $ico . '">' . $name . '</span>');
                     } else {
                         $addtabs[] = array('tab' => '<a href="' . $link . '" class="' . $ico . '">' . $name . '</a>');
                     }
                 } else {
                     if ($active) {
                         $tabs[] = array('tab' => '<span class="' . $ico . '">' . $name . '</span>');
                     } else {
                         $tabs[] = array('tab' => '<a href="' . $link . '" class="' . $ico . '">' . $name . '</a>');
                     }
                 }
             }
         }
     }
     if (isset($mtabs[self::$map['module']]) && $mtabs[self::$map['module']]) {
         s::rollArray('admin_tabs', $mtabs[self::$map['module']]);
         s::set('admin_tabs', files::get(ROOT . STYLE_PATH . 'tmpls/tabs.html'));
         if (isset($addtabs[self::$map['module']])) {
             s::rollArray('admin_right_tabs', $addtabs[self::$map['module']]);
         }
     } else {
         if ($tabs) {
             s::rollArray('admin_tabs', $tabs);
             s::set('admin_tabs', files::get(ROOT . STYLE_PATH . 'tmpls/tabs.html'));
         }
         if ($addtabs) {
             s::rollArray('admin_right_tabs', $addtabs);
         }
     }
     $adapter = $array[$action];
     if (arrays::testKey($adapter, 'title')) {
         self::$map['title'] = $adapter['title'];
     }
     if (arrays::testKey($adapter, 'mode')) {
         self::$map['mode'] = $adapter['mode'];
     }
     if (arrays::testKey($adapter, 'rule')) {
         self::$map['rule'] = $adapter['rule'];
     }
 }
Beispiel #4
0
 function uploadFile()
 {
     $content = '';
     $content = files::get($_FILES['file']['tmp_name']);
     buffer::set('{non}' . htmlspecialchars($content) . '{/non}');
 }