Esempio n. 1
0
 public static function getPDO()
 {
     $MBConfig = MeinBlog::getConfig();
     // global $MBDatabase;
     $MBDatabase = new MeinBlogPDO($MBConfig->property('deploy_level'), $MBConfig->property('db_username'), $MBConfig->property('db_password'), $MBConfig->property('db_host'), $MBConfig->property('db_port'), $MBConfig->property('db_scheme'), $MBConfig->property('db_charset'));
     return $MBDatabase;
 }
Esempio n. 2
0
 function __construct($preset = array())
 {
     if (!empty($preset)) {
         $this->properties = $preset;
     } else {
         $this->properties = array();
     }
     $this->pdo = MeinBlog::getPDO();
 }
Esempio n. 3
0
 public function refreshSession()
 {
     // if(session_status()!=PHP_SESSION_ACTIVE){
     session_start();
     // }
     MeinBlog::log('refreshSession: ' . json_encode($_SESSION));
     if (empty($_SESSION['user_id'])) {
         $this->user_id = null;
         $this->user_info = null;
     } else {
         $this->user_id = $_SESSION['user_id'];
         $this->user_info = $this->getUserAgent()->getUser($this->user_id);
     }
 }
Esempio n. 4
0
		height: auto;
		min-height: 500px;
		float: right;
	}
	</style>
</head>
<body>
	<div id="header">
		<h1>
			<?php 
echo MeinBlog::getConfig()->property('MeinBlog_Title');
?>
			<br>
			<small>
				<?php 
echo MeinBlog::getConfig()->property('MeinBlog_Subtitle');
?>
			</small>
		</h1>
	</div>
	<div id="middle">
		<?php 
if (empty($user_id)) {
    ?>
		<div class="message_box">
			<h3>
				Message:
			</h3>
			<p>
				You have not logined into MeinBlog, or you are not in Admin Group. Now directing to homepage in 3 seconds.
			</p>
Esempio n. 5
0
    ?>
			</div>
			<?php 
    if ($isAdmin && !empty($category_status_list)) {
        ?>
			<div>
				<h2><?php 
        MeinBlog::lang('CATEGORY_HEADER_MODIFY');
        ?>
</h2>
				<?php 
        if (!empty($message)) {
            ?>
				<div class="message_box">
					<h3><?php 
            MeinBlog::lang('MSG_HEADER_TITLE');
            ?>
</h3>
					<p><?php 
            echo $message;
            ?>
</p>
				</div>
				<?php 
        }
        ?>
				<div style="font-size: 18px;">
					<form id="modify_category_form" method='POST'>
						<input type='hidden' name='act' value='modify_category'>
						<dl class="dl-horizontal">
							<dt>
Esempio n. 6
0
						<?php 
        if ($user_info['role'] == 'ADMIN' || $user_id == $file_header->property('main_editor_id')) {
            ?>
						<span class="btn_span" style="padding: 3px 12px;">
							<a class="btn" href="FileEdit.php?file_id=<?php 
            echo $file_header->property('file_id');
            ?>
">Edit</a>
						</span>
						<?php 
        }
        ?>
					</p>
					<blockquote class="file_header_abstract">
						<?php 
        MeinBlog::safeEmptyEcho($file_header->property('abstract'), 'No abstract found.');
        ?>
					</blockquote>
				</div>
			<?php 
    }
}
?>
			</div>	
		</div>
		<div class="right_div">
			<h2>Links</h2>
			<p><span class="btn_span"><a href="index.php" class="btn btn-full-width">Home</a></span></p>
		</div>
		<div class="clear"></div>
	</div>
Esempio n. 7
0
 function update($file_id, $editor_id, $title = false, $abstract = false, $category_id = false, $content = false)
 {
     // MeinBlog::log("update($file_id,$editor_id,$title=false,$abstract=false,$category_id=false,$content=false)");
     if (empty($file_id) || empty($editor_id)) {
         return false;
     }
     $this->pdo->beginTransaction();
     try {
         if ($content !== false) {
             $afx = MBFileContent::update($file_id, $content, $editor_id);
             if ($afx !== 1) {
                 throw new Exception("Error in modifying file content.", 1);
             }
         }
         $sql_set = " update_time=NOW(), main_editor_id = " . $this->pdo->quote($editor_id, PDO::PARAM_INT);
         if ($title !== false) {
             $sql_set .= ', title = ' . $this->pdo->quote($title);
         }
         if ($abstract !== false) {
             if ($abstract === null) {
                 $sql_set .= ', abstract = NULL ';
             } else {
                 $sql_set .= ', abstract = ' . $this->pdo->quote($abstract);
             }
         }
         if ($category_id !== false) {
             $sql_set .= ', category_id = ' . $this->pdo->quote($category_id, PDO::PARAM_INT);
         }
         $sql = "UPDATE mb_file_header SET {$sql_set} WHERE file_id=" . $this->pdo->quote($file_id, PDO::PARAM_INT);
         $afx = $this->pdo->exec($sql);
         if ($afx !== 1) {
             throw new Exception("Error in modifying file header.", 1);
         }
         $this->pdo->commit();
         return true;
     } catch (Exception $e) {
         $this->pdo->rollBack();
         MeinBlog::log($e->getMessage());
     }
     return false;
 }
Esempio n. 8
0
				</p>
				<?php 
    } else {
        ?>
				<p>
					<span class="btn_span"><a href="UserAgency.php" class="btn btn-full-width"><?php 
        MeinBlog::lang('INDEX_BUTTON_MY_PROFILE');
        ?>
</a></span>
				</p>
				<?php 
    }
    ?>
				<p>
					<span class="btn_span"><a href="index.php?act=logout" class="btn btn-full-width"><?php 
    MeinBlog::lang('INDEX_BUTTON_LOGOUT');
    ?>
</a></span>
				</p>
			</div>
			<?php 
}
?>
			<div class="clear"></div>
		</div>
		<div class="clear"></div>
	</div>
	<div id="footer">
		<p>
			Copyright 2015 Sinri Edogawa :: Powered by Project <a href="https://github.com/sinri/MeinBlog">MeinBlog</a>
		</p>