コード例 #1
0
ファイル: sqlite.php プロジェクト: Devenet/MoodPicker
 public static function Instance($database = NULL)
 {
     if (!isset(self::$instances[$database])) {
         if (is_null($database)) {
             $db_info = Config::Get('database');
         } else {
             $db_info = array('name' => $database);
         }
         $db_file = Config::Path(Config::DIR_DATA . DIRECTORY_SEPARATOR . $db_info['name'] . SQLite::DB_EXTENSION);
         if (!file_exists($db_file)) {
             $schema = file_get_contents(Config::Path(Config::DIR_DATA . DIRECTORY_SEPARATOR . $db_info['name'] . SQLite::INIT_EXTENSION));
             $schema = str_replace("\n", ' ', $schema);
             $schema = str_replace("\r", ' ', $schema);
             $db = new SQLite3($db_file, SQLITE3_OPEN_CREATE | SQLITE3_OPEN_READWRITE);
             $db->exec($schema);
         }
         // load database
         self::$instances[$database] = new PDO('sqlite:' . $db_file);
         if (Config::Get('debug')) {
             self::$instances[$database]->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
         } else {
             self::$instances[$database]->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT);
         }
         self::$instances[$database]->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
     }
     self::$access++;
     return self::$instances[$database];
 }
コード例 #2
0
ファイル: index.php プロジェクト: Devenet/MoodPicker
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Code source hosted on https://github.com/Devenet/MoodPicker
*/
set_include_path('./library');
spl_autoload_extensions('.php');
spl_autoload_register();
use Core\Application;
use Core\Config;
use Core\Setting;
use Utils\Menu;
use Manage\Authentification;
if (Config::Get('debug')) {
    error_reporting(-1);
    ini_set('display_errors', 1);
} else {
    error_reporting(0);
    ini_set('display_errors', 0);
}
$app = new Application();
$auth = new Authentification();
$navbar = new Menu();
$navbar->item($app->URL(), 'Share')->item($app->URL('review'), 'Review')->item($app->URL('details'), 'Details');
$navbar_right = new Menu();
if ((new Setting('api_display_doc'))->getValue() || $auth->isLogged()) {
    $navbar_right->item($app->URL('api'), 'API');
} else {
    if ((new Setting('api_requests'))->getValue()) {
コード例 #3
0
ファイル: application.php プロジェクト: Devenet/MoodPicker
 protected function display()
 {
     try {
         $this->template->draw($this->page);
     } catch (\Rain\Tpl\NotFoundException $ex) {
         if (Config::Get('debug')) {
             $tpl = $ex->getTrace()[0]['args'][0] == 404 ? htmlspecialchars($_GET['template']) : $ex->getTrace()[0]['args'][0];
             $this->assign('exception', $tpl);
         }
         header('HTTP/1.1 404 Not Found', TRUE, 404);
         $this->template->assign('navbar', $this->modules[Menu::NAVBAR]->generate('404'));
         $this->template->draw('_404');
     }
 }
コード例 #4
0
ファイル: theme.php プロジェクト: Devenet/MoodPicker
 private function __construct()
 {
     $this->themes = Config::Get('themes');
     $this->theme = is_null(Config::Get('theme')) ? self::DEFAULT_THEME : Config::Get('theme');
 }