common.php 951 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. # return array(video, journal_buy) 1为可以、2为不可以
  3. function checkVersion()
  4. {
  5. $video = 1;
  6. $journal_buy = 1;
  7. $config = Dever::db('main/config')->one();
  8. if (isset($config['video']) && $config['video'] == 2) {
  9. $video = 2;
  10. } elseif (isset($config['version']) && Dever::input('version') && $config['version'] == Dever::input('version')) {
  11. $video = 2;
  12. $journal_buy = 2;
  13. }
  14. return (object) array('video' => $video, 'journal_buy' => $journal_buy);
  15. }
  16. /**
  17. * 音视频转换
  18. */
  19. function convert($url, $ext = 'mp4', $table = false, $id = false, $col = '')
  20. {
  21. if ($url && !strstr($url, '_c.' . $ext)) {
  22. $file = $url . '_c.' . $ext;
  23. if (Dever::is_file($file)) {
  24. $url = $file;
  25. if ($table) {
  26. Dever::db($table)->update(array('where_id' => $id, $col => $file));
  27. }
  28. }
  29. }
  30. return $url;
  31. }