Example #1
0
 public function __construct($filename)
 {
     global $settings;
     $templateurl = append_slash(get_setting('template', 'path')) . append_slash($settings['templateset']);
     // get_setting('template', 'tplfolder')
     $this->source = $templateurl . 'source/' . $filename;
     $this->compiled = $templateurl . 'compiled/' . $filename;
     if (!assert(is_readable($this->source))) {
         echo "Cannot find the template: {$filename}";
     }
     if (!assert(is_writable(dirname($this->compiled)))) {
         echo "Cannot write to the compiled template directory";
     }
 }
Example #2
0
 public function Execute(Template $template, Session $session, $request)
 {
     $this->dba = DBA::Open();
     /* Nice ancestors bar */
     $template = CreateAncestors($template, $template['L_ADMINPANEL']);
     /* Check user permissions */
     if ($session['user'] instanceof Member && $session['user']['perms'] & ADMIN) {
         /* Set the templates */
         $template->content = array('file' => 'admin/admin.html');
         //$template->admin_panel	= array('file' => 'admin/options.html');
         $template->admin_panel = array('file' => 'admin/forum_options.html');
         $setting_groups = new SettingsList();
         $template->setting_groups = $setting_groups;
         /* Get all of our template sets */
         $templates = array();
         $fullpath = get_setting('template', 'path');
         $dir = dir($fullpath);
         while (false !== ($folder = $dir->Read())) {
             if (is_dir(append_slash($fullpath) . $folder) && $folder != '.' && $folder != '..') {
                 $templates[] = array('name' => $folder);
             }
         }
         /* Get all of our image sets */
         $img_folders = array();
         $fullpath = append_slash(get_setting('config', 'forumurl')) . 'Images';
         $dir = dir($fullpath);
         while (false !== ($folder = $dir->Read())) {
             if (is_dir(append_slash($fullpath) . $folder) && $folder != '.' && $folder != '..') {
                 $img_folders[] = array('name' => $folder);
             }
         }
         /* Get and set the forums options values */
         foreach ($this->dba->GetRow("SELECT * FROM " . FORUMS . " WHERE row_left = 1") as $key => $val) {
             $template[$key] = $val;
         }
         /* Set the current styleset */
         $template['styleset'] = get_setting('theme', 'styleset');
         /* Set the list of stylesets */
         $template->stylesets = $this->dba->Query("SELECT * FROM " . STYLES . " ORDER BY name DESC");
         /* Set the template and image sets lists */
         $template->templates = $templates;
         $template->img_folders = $img_folders;
     }
     /* Set the number of queries */
     $template['num_queries'] = $session->dba->num_queries;
     return TRUE;
 }
Example #3
0
 public function Execute($str)
 {
     if ($this->use_db) {
         foreach (DBA::Open()->Query("SELECT * FROM " . EMOTICONS) as $emo) {
             //$str = preg_replace("~\s". addcslashes($emo['typed'] , "\$\%\@\!\*\#\(\:\)\\\/\+\-\[\]") ."\s~is", '<!-- EMO-'. $emo['typed'] .' --><img src="Images/'.append_slash(get_setting('template', 'imgfolder')).'Icons/Emoticons/'. $emo['image'] .'" alt="'. $emo['description'] .'" /><!-- /EMO -->', $str);
             $str = str_ireplace($emo['typed'], '<!-- EMO-' . $emo['typed'] . ' --><img src="Images/' . append_slash(get_setting('template', 'imgfolder')) . 'Icons/Emoticons/' . $emo['image'] . '" alt="' . $emo['description'] . '" /><!-- /EMO -->', $str);
         }
     }
     return $str;
 }
Example #4
0
 public function SelectDb($database)
 {
     $database = append_slash(get_setting('sqlite', 'directory')) . $database;
     if (!file_exists($database) && !is_writable(dirname($database))) {
         throw new DBA_Exception(DBA::E_INVALID_DATABASE, "Unable to create database [{$database}]");
         return FALSE;
     }
     $mode = get_setting('sqlite', 'mode') or $mode = 0666;
     $this->link = sqlite_open($database, $mode, $conn_error);
     if ($this->link === FALSE) {
         throw new DBA_Exception(DBA::E_INVALID_DATABASE, "Unable to open database [{$conn_error}]");
         return FALSE;
     }
 }