<?php require_once "Pics.php"; if (isset($_POST['uid'])) { $smarty->assign("uid", $_POST['uid']); } $userPics = new Pics(); if (isset($_POST['uid']) && $_POST['uid'] > 0) { //print_r($_POST); $userPictures = $userPics->picsByUid($_POST['uid']); //print_r($userPictures); $smarty->assign("userPics", $userPictures); } else { if (isset($_POST)) { foreach ($_POST as $pic) { $rmOrig = "./images/{$pic}"; $rmThumb = "./images/thb_{$pic}"; $rmPop = "./images/pop_{$pic}"; $out = unlink($rmOrig); $out = unlink($rmThumb); $out = unlink($rmPop); $userPics->deletePics($pic); } } }
<?php require_once "Pics.php"; if (isset($_POST['uid'])) { $smarty->assign("uid", $_POST['uid']); } $user = StoreSession::user(); if (isset($user)) { $userPics = new Pics(); $userPictures = $userPics->picsByName($user); //print_r($userPictures); $smarty->assign("userPics", $userPictures); }
<?php if ($picId == 'new') { $picInsert = new PicInsert(); $pic = new Pic(); } else { $picUpdate = new PicUpdate($picId); $pics = new Pics($picId); $pic = new Pic($pics->getPic()); } $picDelete = new PicDelete($pic); ?> <form enctype="multipart/form-data" class="box pics" method="post" action="<?php echo BASEPATH . DS . $page . DS . $tab . DS . $picId; ?> " name="picform"> <ul class="layout"> <li> <label for="pic_name">Name: </label> <input id="pic_name" class="pic_input" type="text" value="<?php echo $pic->getName(); ?> " name="name" autocomplete="off" placeholder="Bildbeschreibung eingeben" required /> </li> <li> <label for="pic_image">Image: </label><br> <img src="<?php echo $pic->getFilename(); ?> ">
<?php require_once __DIR__ . '/../includes/helpers.php'; require_once __DIR__ . '/../loader.php'; $page = !empty($_GET['page']) ? (int) $_GET['page'] : 1; $per_page = 2; $pics = Pics::findPaginate($page, $per_page); if (!$pics) { redirect_to('index.php'); } $paging = $pics[count($pics) - 1]; $images = array_pop($pics); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> <!--<link rel="icon" href="../../favicon.ico"> --> <title>Photolia</title> <!-- Bootstrap core CSS --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous"> <!-- Custom styles for this template --> <link href="../css/style.css" rel="stylesheet"> <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<?php require_once __DIR__ . '/../../includes/helpers.php'; require_once __DIR__ . '/../../loader.php'; Session::checkSession(); $a = new Auth(); if (!$a->isLoggedIn()) { redirect_to('login.php'); exit; } $u = User::getUser(); $msg = ""; if (isset($_POST['addPicture'])) { $p = new Pics(); $p->caption = $_POST['caption']; $p->slug = slugify($_POST['caption']); $upload = $p->start($_FILES['picture']); if ($upload) { Logger::start()->add($u->username, $_SERVER['PHP_SELF'], 'File Upload'); $msg = opmsg("Picture uploaded successfully", "success"); } else { $msg = opmsg($p->errors[0], "failed"); } } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1">
<?php require_once "Pics.php"; if (isset($_POST['uid'])) { $smarty->assign("uid", $_POST['uid']); } if (isset($_POST['uid']) && $_POST['uid'] > 0) { $userPics = new Pics(); $userPictures = $userPics->admCommsByUid($_POST['uid']); $smarty->assign("userPics", $userPictures); } else { if (isset($_POST)) { $adminComm = new Pics(); foreach ($_POST as $key => $comment) { if (isset($key) && isset($comment)) { $adminComm->updateAC($key, $comment); } } } }
<?php require_once __DIR__ . '/../../includes/helpers.php'; require_once __DIR__ . '/../../loader.php'; Session::checkSession(); $a = new Auth(); if (!$a->isLoggedIn()) { redirect_to('login.php'); exit; } $u = User::getUser(); //$l = Logger::start(); $msg = ""; if (isset($_POST['edit'])) { $pic = Pics::getPic($_POST['eid']); if ($pic) { $id = $pic->id; $caption = $pic->caption; $file = "../images/" . $pic->filename; } else { redirect_to('manageusers.php'); exit; } } if (isset($_POST['update'])) { $id = $_POST['id']; $data = array('username' => $_POST['username'], 'password' => password_hash($_POST['password'], PASSWORD_BCRYPT), 'fname' => $_POST['fname'], 'lname' => $_POST['lname']); $update = User::update($id, $data); if ($update) { $msg = opmsg("User Updated Successfully", "success"); redirect_to('manageusers.php');
<?php incImage(); require_once "ThumbNail.php"; require_once "Pics.php"; if (isset($_POST['uid'])) { $smarty->assign("uid", $_POST['uid']); } if (isset($_POST['uid']) && $_POST['uid'] > 0) { $userPics = new Pics(); $userPictures = $userPics->picsByUid($_POST['uid']); $smarty->assign("userPics", $userPictures); }
<?php incImage(); incHttpUpload(); require_once "Upload.php"; require_once "Pics.php"; require_once "ThumbNail.php"; $upload = new Http_Upload('en'); $files = $upload->getFiles(); if (PEAR::isError($files)) { die($files->getMessage()); } $success = ""; $uid = $_POST['uid']; $smarty->assign("action", "upload.php?pre=" . $_POST['uid']); $userPic = new Pics(); foreach ($files as $file) { //print_r($file->getProp()); if ($file->isValid()) { $smarty->assign("uid", $uid); $filePre = $_GET['pre']; $file->setName('uniq'); $destDir = './images/'; $destName = $file->moveTo($destDir); $realName = $file->getProp('real'); $userPic->insertToUP($filePre, $destName); /*resize the pictures*/ $resize = new ThumbNail($destDir . $destName); $resize->build($destName); $success = $success . "*Uploaded file {$realName} <br>"; }
public function loadModel($id) { $model = Pics::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
public function actionAjaxReq() { $val1 = $_POST['val_id']; $id = (int) substr($val1, 2, strrpos($val1, ".") - 2); $side = (int) substr($val1, strrpos($val1, ".") + 1) + 1; $criteria = new CDbCriteria(); $criteria->select = "name,ptype"; $criteria->condition = "bb_id={$id} AND (side=0 OR side={$side})"; $rows = Pics::model()->findAll($criteria); // $bb = Bb::model()->findByPk($id); $res = ""; for ($ii = 0; sizeof($rows) > $ii; $ii++) { if ($rows[$ii]['ptype'] == 'image') { $res .= "<img class=\"resize\" onmouseover=\"pichover(this,event)\" onmouseout=\"picout(this)\" onmousemove=\"picmove(this,event)\" src=\"" . Yii::app()->request->baseUrl . "/images/" . $rows[$ii]['name'] . "\" >"; } else { $res .= "<img class=\"resize\" onmouseover=\"pichover(this,event)\" onmouseout=\"picout(this)\" onmousemove=\"picmove(this,event)\" src=\"//api-maps.yandex.ru/services/constructor/1.0/static/?sid=" . $rows[$ii]['name'] . "\" alt=\"\"/>"; } } echo $res; Yii::app()->end(); }
<?php $pics = new Pics(); ?> <ul class="adm-pics layout"> <a href="<?php echo BASEPATH . DS . $page . DS . $tab . DS; ?> new"> <li class="box"> <h3 class="glow"><i class="fa fa-plus-circle"></i> Neues Bild hinzufügen</h3> </li> </a> </ul> <div class="pics box layout"> <?php for ($i = 0; $i < $pics->getTotalPics(); $i++) { $pic = new Pic($pics->getPic($i)); ?> <div class="table left"> <div class="cell"> <a href="<?php echo BASEPATH . DS . $page . DS . $tab . DS; echo $pic->getId(); ?> "> <img class="left" src="<?php echo $pic->getFilename(); ?>
require_once __DIR__ . '/../../includes/helpers.php'; require_once __DIR__ . '/../../loader.php'; Session::checkSession(); $a = new Auth(); if (!$a->isLoggedIn()) { redirect_to('login.php'); exit; } $u = User::getUser(); $pics = Pics::getAllPics(); //$l = Logger::start(); $msg = ""; if (isset($_POST['del'])) { $id = intval($_POST['did']); $d = Pics::delete($id); if ($d) { $msg = opmsg("Pic Deleted Successfully", "success"); redirect_to('managepics.php'); } else { $msg = opmsg("Pic Not Deleted", "danger"); } } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<?php require_once __DIR__ . '/../includes/helpers.php'; require_once __DIR__ . '/../loader.php'; if (empty($_GET['id']) and empty($_GET['slug'])) { redirect_to("index.php"); } if (isset($_GET['id'])) { $p = Pics::getPic($_GET['id']); } else { $p = Pics::getBySlug($_GET['slug']); } $c = Comment::findComments($p->id); if (!$p) { redirect_to("index.php"); } if (isset($_POST['submit'])) { if (CSRF::check($_POST['token'])) { $author = htmlspecialchars($_POST['author']); $body = htmlspecialchars($_POST['body']); $comment = Comment::make($p->id, $author, $body); if ($comment) { $comment->create(); $msg = opmsg("Comment posted successfully and awaiting moderation!", "success"); } else { $msg = opmsg("Failed", "danger"); } } else { $msg = opmsg("Failed", "danger"); } } else {
<th class="text-center">Picture</th> <th class="text-center">Author</th> <th class="text-center">Body</th> <th class="text-center">Added On</th> <th class="text-center">Last Edited</th> <th class="text-center">Status</th> <th class="text-center">Delete</th> </tr> </thead> <tbody> <?php foreach ($comments as $c) { ?> <tr> <td class="text-center" data-title="Picture"><img style="width:100px;height:100px;" class="img-thumbnail" src="../images/<?php echo Pics::getPic($c->pid)->filename; ?> "></td> <td class="text-center" data-title="Author"><?php echo $c->author; ?> </td> <td class="text-center" data-title="Body"><?php echo $c->body; ?> </td> <td class="text-center" data-title="Added On"><?php echo $c->created_at; ?> </td> <td class="text-center" data-title="Last Edited"><?php
public function actionAjaxReq() { $val1 = $_POST['val_id']; $tcall = strrpos($val1, "."); $criteria = new CDbCriteria(); $criteria->select = "name,side,ptype,id"; if ($tcall > 0) { $id = (int) substr($val1, 2, $tcall - 2); $side = (int) substr($val1, $tcall + 1) + 1; $criteria->condition = "bb_id={$id} AND (side=0 OR side={$side})"; } else { $id = (int) $val1; $criteria->condition = "bb_id={$id}"; } $rows = Pics::model()->findAll($criteria); // $bb = Bb::model()->findByPk($id); $res = ""; if (!($tcall > 0)) { $res .= "<table id=\"gtw\">"; } for ($ii = 0; sizeof($rows) > $ii; $ii++) { if (!($tcall > 0)) { $res .= "<tr><td>"; } if ($rows[$ii]['ptype'] == 'image') { $res .= "<img class=\"resize\" onmouseover=\"pichover(this,event)\" onmouseout=\"picout(this)\" onmousemove=\"picmove(this,event)\" src=\"" . Yii::app()->request->baseUrl . "/images/" . $rows[$ii]['name'] . "\" >"; } else { $res .= "<img class=\"resize\" onmouseover=\"pichover(this,event)\" onmouseout=\"picout(this)\" onmousemove=\"picmove(this,event)\" src=\"//api-maps.yandex.ru/services/constructor/1.0/static/?sid=" . $rows[$ii]['name'] . "\" alt=\"\"/>"; } if (!($tcall > 0)) { $res .= "</td><td>" . $rows[$ii]['name'] . "</td>"; $res .= "<td>[" . $rows[$ii]['side'] . "];" . $rows[$ii]['ptype'] . "</td>"; $res .= "<td class=\"button-column\">"; $res .= CHtml::link(CHtml::image(Yii::app()->request->baseUrl . "/css/buts/update.png", "Редактировать"), array("pics/update", "id" => $rows[$ii]['id']), array('title' => 'Редактировать', 'target' => '_blank')); $res .= CHtml::link(CHtml::image(Yii::app()->request->baseUrl . "/css/buts/delete.png", "Удалить"), array("pics/delete", "id" => $rows[$ii]['id']), array('class' => 'delete', 'title' => 'Удалить', 'onclick' => 'return confirm("Удаляем картинку?")')); $res .= "</td></tr>"; } } if (!($tcall > 0)) { $res .= "</table>"; } echo $res; Yii::app()->end(); }
<?php require_once "Pics.php"; $user = StoreSession::user(); if (isset($user)) { $userPics = new Pics(); $userPictures = $userPics->commByName($user); $smarty->assign("userPics", $userPictures); } if (isset($_POST)) { $userComm = new Pics(); foreach ($_POST as $key => $comment) { if (isset($key) && isset($comment)) { $userComm->updateUC($key, $comment); } header('Location: view.php'); } }