Пример #1
0
 public static function create_stack()
 {
     $filename = HCImport::stack_temp();
     if (file_exists($filename)) {
         unlink($filename);
     }
     Stack::create_file($filename);
     HCImport::load_stack();
     HCImport::index_blocks();
     HCImport::decode_stak();
     $new_file = new Stack($filename);
     $new_stack = $new_file->stack_load();
     $new_stack['card_width'] = HCImport::$stack['card_width'];
     $new_stack['card_height'] = HCImport::$stack['card_height'];
     $new_file->stack_save($new_stack);
     $new_file->zap_all_cards();
     return HCImport::$stack;
 }
Пример #2
0
 public static function new_stack($inbound, $outbound)
 {
     global $config;
     if (!$config->restrictions->can_new_stack) {
         throw new Exception('Creating new stacks is not allowed.', 403);
     }
     Util::keys_required($inbound, array('id'));
     $stack_id = Util::safe_stack_id($inbound['id'], true);
     Stack::create_file($stack_id);
     return $outbound;
 }
Пример #3
0
 public static function new_stack($inbound, $outbound)
 {
     global $config;
     if (!$config->restrictions->can_new_stack) {
         throw new Exception('Creating new stacks is not allowed.', 403);
     }
     $stack_id = Util::safe_stack_id($inbound['stack_id'], true);
     Stack::create_file($stack_id);
     if (file_exists($stack_id)) {
         $outbound['stack_id'] = $inbound['stack_id'];
     } else {
         throw new Exception("Couldn't create stack.", 520);
     }
     return $outbound;
 }