/** * */ public function testSlugCase() { $test1 = ' Normal case to slug case'; $test2 = 'Nõrmàl çĀse to slûg çasé'; $this->assertEquals(slugify($test1), 'normal-case-to-slug-case'); $this->assertEquals(slugify($test2), 'normal-case-to-slug-case'); }
public function getSlugAttribute() { if (!$this->slug) { $this->slug = slugify($this->getKey(), isset(static::$slugText) ? $this->{static::$slugText} : $this->name ?? $this->title ?? ''); } return $this->slug; }
public function testslugify() { $titles = array("Test" => "test", "Überschrift" => "ueberschrift", "Leer Zeichen" => "leer-zeichen", "Fuß" => "fuss", "Sonderzeichen?=%" => "sonderzeichen", "Rosé" => "rose", "Weinbrief Nr. 18" => "weinbrief-nr-18"); foreach ($titles as $title => $slug) { $this->assertEquals(slugify($title), $slug); } }
protected function storeDiskSettingsBackEnd($directory_name, $directory_driver, $is_directory_public = false) { $directory_url = null; $directory_root = null; $directory_path = null; $directory_name = str_replace('-', '_', slugify($directory_name)); switch ($directory_driver) { case 'local': default: if ($is_directory_public) { $directory_root = 'uploads/' . Environments::currentEnvironment() . '/' . $directory_name; $directory_url = url($directory_root); $directory_path = public_path($directory_root); } else { $directory_root = 'app/' . Environments::currentEnvironment() . '/' . $directory_name; $directory_url = url($directory_root); $directory_path = public_path($directory_root); } break; } File::makeDirectory($directory_path, 0777, true); $disk = ['driver' => $directory_driver, 'root' => $directory_path]; if ($is_directory_public) { $disk['visibility'] = 'public'; } $this->addFileSystemDisk($directory_name, $disk, Environments::currentEnvironment()); $this->mountElFinderDisk($directory_name, ['alias' => $directory_path, 'URL' => $directory_url, 'access' => ['readonly' => true, 'roles' => [RolesRepositoryEloquent::ADMIN], 'permissions' => [PermissionsRepositoryEloquent::CAN_READ_BACKUPS_DIRECTORY]]], Environments::currentEnvironment()); }
function fetch_and_parse_image($fansub_id, $url, $description) { global $website_directory; preg_match_all('/<img [^>]*src=["|\']([^"|\']+)/i', $description, $matches); $first_image_url = NULL; if (isset($matches) && isset($matches[1])) { for ($i = 0; $i < count($matches[1]); $i++) { if (strpos($matches[1][$i], '.svg') === FALSE) { $first_image_url = $matches[1][$i]; break; } } } if ($first_image_url != NULL) { if (strpos($first_image_url, "://") === FALSE) { $first_image_url = $url . $first_image_url; } if (!is_dir("{$website_directory}/images/news/{$fansub_id}/")) { mkdir("{$website_directory}/images/news/{$fansub_id}/"); } if (@copy($first_image_url, "{$website_directory}/images/news/{$fansub_id}/" . slugify($first_image_url))) { return slugify($first_image_url); } else { if (file_exists("{$website_directory}/images/news/{$fansub_id}/" . slugify($first_image_url))) { //This means that the file is no longer accessible, but we already have it locally! return slugify($first_image_url); } } } return NULL; }
/** * Callback for submit-button. * */ public function callbackSubmit() { $email = $this->Value('email'); $this->user = new \Anax\Users\User(); $this->user->setDI($this->di); $res = $this->user->findByEmail($email); if (count($res) >= 1) { $userid = $res[0]->getProperties()['id']; $acronym = $res[0]->getProperties()['acronym']; $temp = slugify($acronym . '7D3F5G23j5B52D3' . $userid); $encrypt = password_hash($temp, PASSWORD_DEFAULT); $link = $this->url . 'users/reset/' . $userid . '/' . $encrypt; $message = "The password restore link was sent to your e-mail."; $to = $email; $subject = "Password recovery"; $from = ADMIN_MAIL; $body = 'Hi ' . $acronym . '. Follow this link to choose a new password: '******' Kind regards, Volvo S90 Q&A admin.'; $headers = "From: " . strip_tags($from) . "\r\n"; $headers .= "Answer to: " . strip_tags($from) . "\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; $sent = mail($to, $subject, $body, $headers); $this->user->save(array('id' => $userid, 'password' => $encrypt)); if ($sent) { return true; header('location: www.volvo-s90.com/users/login'); } else { return false; } } else { return false; } }
function exec_gh_pages() { ob_start(); require_once 'www/gh-index.php'; mkdir('gh-pages'); $data = ob_get_clean(); if ($f = fopen('gh-pages/index.html', 'w+')) { fwrite($f, $data); fclose($f); } $countries = get_countries(); /** @var Country $country */ foreach ($countries as $country) { $filename = slugify($country->getCode3l()) . '.html'; if ($f = fopen('gh-pages/' . $filename, 'w+')) { $_GET['code'] = $country->getCode3l(); ob_start(); $page_title = $country->getNameOfficial(); require 'www/includes/header.inc'; require 'www/detail.php'; require 'www/includes/footer.inc'; $data = ob_get_clean(); fwrite($f, $data); fclose($f); } } }
public function getJobTitleURL() { global $lang; $job = R::load('jobs', $this->_job_id); $job_url = $job->title . " {$lang->t('jobs|at')} " . $job->company_name; return slugify($job_url); }
/** * * * @param $group * @param $text * @param bool $permission * @param array $attributes * @return $this|void */ public function addItem($group, $text, $permission = false, $attributes = array()) { if ($permission === false) { $permission = true; } $this->siteNavModule->addGroupIf($permission, $text, slugify($group), val('class', $attributes), '', $attributes); return $this; }
public function postSubmit(EventReq $req) { $event = new Event(); $event->save(); $event->staff()->attach(\Auth::user(), ['created_at' => $event->created_at, 'updated_at' => $event->updated_at]); $id_slug = slugify($event->id, $event->title); return redirect()->action('EventController@getDetails', $id_slug); }
public function checkSlug($slug) { $slugify = slugify($slug); $checkSlug = $this->mproduct->checkSlug($slug); if ($checkSlug) { return $checkSlug; } else { return $slugify; } }
function checkSlug($slug) { $this->db->like('slug', $slug); $query = $this->db->get('product'); if (checkRes($query)) { return $this->getLatestExistsSlug($slug); } else { return slugify($slug); } }
function parse_themes($str) { if (empty($str)) { return; } $themes = explode(",", $str); $themes = array_map(function ($theme) { return slugify(trim($theme)); }, $themes); return $themes; }
/** Returns the product category url */ function category_url($category, $parents = array()) { $url = ''; //check if this is a grandparent, parent, or child if ($parents) { foreach ($parents as $parent) { $url .= slugify($parent->name) . '/'; } } $ret = base_url() . 'category/' . $category->id . '/' . $url . slugify($category->name); return $ret; }
/** * Callback for submit button. * */ public function callbackSubmit() { $now = date('Y-m-d H:i:s'); $this->user = new \Anax\Users\User(); $this->user->setDI($this->di); $this->user = $this->user->find($this->userid); $acronym = $this->user->getProperties()['acronym']; $email = $this->user->getProperties()['email']; $web = $this->user->getProperties()['web']; $tags = ''; $tagslugs = ''; if (isset($_POST['tag'])) { foreach ($_POST['tag'] as $key => $val) { $slug = slugify($val); $tagslugs .= $slug . ','; $tags .= $val . ','; // Update total number of tags $this->tag = new \Anax\Question\Tag(); $this->tag->setDI($this->di); $tag = $this->tag->findTag($slug); $questions = $tag[0]->getProperties()['questions']; $tagid = $tag[0]->getProperties()['id']; $this->tag->customUpdate('tag', array('questions' => $questions + 1), 'id = ' . $tagid); } // Remove 1 from old data $oldtags = explode(',', $this->tagslug); foreach ($oldtags as $key => $val) { $this->tag = new \Anax\Question\Tag(); $this->tag->setDI($this->di); $tag = $this->tag->findTag($val); $questions = $tag[0]->getProperties()['questions']; $tagid = $tag[0]->getProperties()['id']; $this->tag->customUpdate('tag', array('questions' => $questions - 1), 'id = ' . $tagid); } $tags = rtrim($tags, ','); $tagslugs = rtrim($tagslugs, ','); } $tags = empty($tags) ? $this->tag : $tags; $tagslugs = empty($tagslugs) ? $this->tagslug : $tagslugs; $slug = slugify($this->Value('title')); $this->question = new \Anax\Question\Question(); $this->question->setDI($this->di); $saved = $this->question->save(array('id' => $this->id, 'tag' => $tags, 'tagslug' => $tagslugs, 'title' => $this->Value('title'), 'slug' => $slug, 'content' => $this->Value('content'), 'mail' => $email, 'acronym' => $acronym, 'web' => $web, 'updated' => $now, 'ip' => $this->di->request->getServer('REMOTE_ADDR'), 'gravatar' => 'http://www.gravatar.com/avatar/' . md5(strtolower(trim($email))) . '.jpg')); //$this->saveInSession = true; if ($saved) { return true; } else { return false; } }
/** * Updates a particular model. * If update is successful, the browser will be redirected to the 'view' page. * @param integer $id the ID of the model to be updated */ public function actionUpdate($id) { $model = $this->loadModel($id); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Location'])) { $model->attributes = $_POST['Location']; if (null === $model->slug || '' === $model->slug) { $model->slug = slugify($model->name); } if ($model->save()) { $this->redirect(array('view', 'id' => $model->id)); } } $this->render('update', array('model' => $model)); }
function getLatestExistsSlug($slug, $table) { $this->db->order_by($table . '_id', "desc"); $this->db->like('slug', slugify($slug)); $this->db->limit(1); $query = $this->db->get($table); $slugName = checkRow($query); if (strpos($slugName->slug, '-') !== false) { $getLastDigit = substr($slugName->slug, strrpos($slugName->slug, '-') + 1); $latestSlugPlus = $getLastDigit + 1; $latestSlugClear = preg_replace('/[0-9]+/', '', $slugName->slug); return rtrim($latestSlugClear, '-') . '-' . $latestSlugPlus; } else { return $slugName->slug . '-' . 1; } }
/** * @param $plugin string|array * plugin name or array with info */ public function __construct($plugin) { if (is_string($plugin)) { $this->name = $plugin; $this->source = ''; // $this->crearPluginDetallado($plugin); $this->slug = slugify($this->name); } else { // var_dump($plugin); // $this->name=$plugin['name']; // $this->source=get_stylesheet_directory().$plugin['source']; // $this->slug=$plugin['slug']; $this->crearPluginDetallado($plugin); } // var_dump($this); }
/** * Callback for submit-button. * */ public function callbackSubmit() { if (empty($_POST['tag'])) { $this->AddOutput("<p><i>You need to choose at least one tag!</i></p>"); return false; } $now = date('Y-m-d H:i:s'); $this->user = new \Anax\Users\User(); $this->user->setDI($this->di); $user = $this->user->find($this->id); $acronym = $user->getProperties()['acronym']; $email = $user->getProperties()['email']; $web = $user->getProperties()['web']; $userid = $user->getProperties()['id']; $xp = $user->getProperties()['xp']; $tags = ''; $tagslugs = ''; foreach ($_POST['tag'] as $key => $val) { $slug = slugify($val); $tagslugs .= $slug . ','; $tags .= $val . ','; // Update total number of tags $this->tag = new \Anax\Question\Tag(); $this->tag->setDI($this->di); $tag = $this->tag->findTag($slug); $questions = $tag[0]->getProperties()['questions']; $tagid = $tag[0]->getProperties()['id']; $this->tag->customUpdate('tag', array('questions' => $questions + 1), 'id = ' . $tagid); } $tags = rtrim($tags, ','); $tagslugs = rtrim($tagslugs, ','); $slug = slugify($this->Value('title')); $this->newquestion = new \Anax\Question\Question(); $this->newquestion->setDI($this->di); $saved = $this->newquestion->save(array('tag' => $tags, 'tagslug' => $tagslugs, 'title' => $this->Value('title'), 'slug' => $slug, 'content' => $this->Value('content'), 'mail' => $email, 'acronym' => $acronym, 'userid' => $userid, 'web' => $web, 'timestamp' => $now, 'updated' => $now, 'ip' => $this->di->request->getServer('REMOTE_ADDR'), 'gravatar' => 'http://www.gravatar.com/avatar/' . md5(strtolower(trim($email))) . '.jpg')); // $this->saveInSession = true; if ($saved) { // Give xp to the user $user->update(array('xp' => $xp + 3)); return true; } else { return false; } }
/** * @param Request $request * @param Model $item * @param array $fields * @param $groupName * @param $fieldName * @param bool $mustDeleteFilesInFilesystem * * @throws \Exception * * @return array */ protected function handleField(Request $request, $item, array $fields, $groupName, $fieldName, $mustDeleteFilesInFilesystem = false) { $normalizeGroupName = str_replace('.', '#', $groupName); $contentFromUploadedField = "uploaded-content.{$normalizeGroupName}#{$fieldName}#"; $modelFolder = $this->slug . DIRECTORY_SEPARATOR; $basePath = base_path(DIRECTORY_SEPARATOR . 'public' . DIRECTORY_SEPARATOR . config('anavel-crud.uploads_path')); $modelPath = $basePath . $modelFolder; $skip = null; $requestValue = null; if (!empty($fields["{$fieldName}__delete"])) { //We never want to save this field, it doesn't exist in the DB $skip = "{$fieldName}__delete"; //If user wants to delete the existing file if (!empty($request->input("{$groupName}.{$fieldName}__delete"))) { $adapter = new Local($basePath); $filesystem = new Filesystem($adapter); if ($filesystem->has($item->{$fieldName}) && $mustDeleteFilesInFilesystem) { $filesystem->delete($item->{$fieldName}); } $item->setAttribute($fieldName, null); return ['skip' => $skip]; } } if ($request->has($contentFromUploadedField)) { $requestValue = $request->input($contentFromUploadedField); } elseif ($request->hasFile($groupName . '.' . $fieldName)) { $fileName = pathinfo($request->file($groupName . '.' . $fieldName)->getClientOriginalName(), PATHINFO_FILENAME); $extension = pathinfo($request->file($groupName . '.' . $fieldName)->getClientOriginalName(), PATHINFO_EXTENSION); $fileName = uniqid() . '_' . slugify($fileName); if (!empty($extension)) { $fileName .= '.' . $extension; } $request->file($groupName . '.' . $fieldName)->move($modelPath, $fileName); $requestValue = $modelFolder . $fileName; } elseif (!empty($request->file($groupName . '.' . $fieldName)) && !$request->file($groupName . '.' . $fieldName)->isValid()) { throw new \Exception($request->file($groupName . '.' . $fieldName)->getErrorMessage()); } //Avoid losing the existing filename if the user doesn't change it: if (empty($requestValue) && !empty($item->{$fieldName})) { $requestValue = $item->{$fieldName}; } return ['requestValue' => $requestValue, 'skip' => $skip]; }
public function actionEdit($id) { $project = $this->loadModel($id); $image = new Image(); if (!Yii::app()->user->checkAccess('updateProject', array('project' => $project))) { throw new CHttpException(403); } if (!isset($_POST['Project'])) { $this->render('edit', array('project' => $project, 'image' => $image)); Yii::app()->end(); } $project->attributes = $_POST['Project']; $project->slug = slugify($project->name); if (!isset($_POST['Project']['champs'])) { $project->champs = null; } if (isset($_POST['ajax'])) { echo CActiveForm::validate($project, null, false); Yii::app()->end(); } if (!$project->validate()) { $this->render('edit', array('project' => $project, 'image' => $image)); Yii::app()->end(); } $image->attributes = $_POST['Image']; $image->file = CUploadedFile::getInstance($image, 'file'); if ($image->file) { if (!$image->save()) { $this->render('edit', array('project' => $project, 'image' => $image)); Yii::app()->end(); } $project->image_id = $image->id; } if (!$project->save()) { $image->delete(); Yii::log('Project::save() failed. $errors = ' . print_r($project->getErrors(), true), 'error', 'app.project.edit'); $form->addError('save', 'Failed save the changes to the project.'); $this->render('edit', array('project' => $project, 'image' => $image)); Yii::app()->end(); } $this->renderText('window.parent.location = "' . $this->createUrl('view', array('id' => $project->id)) . '";'); }
/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new Region(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Region'])) { $model->attributes = $_POST['Region']; if (null === $model->slug || '' === $model->slug) { $model->slug = slugify($model->name); } $feed = new Feed(); $feed->save(); $model->feed_id = $feed->id; if ($model->save()) { $this->redirect(array('view', 'id' => $model->id)); } else { $feed->delete(); } } $this->render('create', array('model' => $model)); }
function downloadVideo() { $id_video = $this->input->post('id_video'); $videodata = $this->mod_io_m->init('id_video', $id_video, TBL_VIDEO); $link = $this->hentai_m->getFacebookVideoSource($id_video); if (!$link) { echo json_encode(array('result' => 'ERROR', 'message' => 'Link is not existed. Download failure.')); exit; } else { $sql = "INSERT INTO " . TBL_TRANSACTION . " (id_owner,id_user,amount,trans_type,site_amt,trans_date,ip) \r\n\t\t\t\t\tVALUES('" . getAccountUserId() . "',1,'" . $GLOBALS['global']['ADMIN_DEFAULT']['download'] . "','" . $GLOBALS['global']['TRANS_TYPE']['download'] . "','" . $GLOBALS['global']['ADMIN_DEFAULT']['download'] . "',NOW(),'" . $_SERVER['REMOTE_ADDR'] . "')"; $this->db->query($sql); $this->db->query("UPDATE " . TBL_USER . " SET cash= cash +'" . $GLOBALS['global']['ADMIN_DEFAULT']['download'] . "' WHERE id_admin=1"); $this->db->query("UPDATE " . TBL_USER . " SET cash= cash -'" . $GLOBALS['global']['ADMIN_DEFAULT']['download'] . "' WHERE id_user='******'"); $session_key = md5(getAccountUserId() . time() . $id_video); $_SESSION['file'][$session_key] = array('name' => slugify($videodata->name) . '.mp4', 'link' => $link); //$downloadLink = site_url().'download.php?id='.$session_key; $downloadLink = $link; echo json_encode(array('result' => 'ok', 'message' => "<div id='downloadIconID'><a href='{$downloadLink}' target='_blank'><img src='" . site_url() . 'media/images/download.png' . "' /></a></div>")); exit; } }
<ul class="content"> <?php while ($article = row_assoc($content)) { ?> <li> <a href="<?php echo BASE_URL; ?> news/<?php echo $page; ?> /<?php echo $article['id']; ?> /<?php echo slugify($article['title']); ?> "> <small><?php echo beautify_datetime($article['published']); ?> </small> <h3><?php echo $article['title']; ?> </h3> <p><?php echo shorten_string($article['content'], 250); ?> </p> </a>
public function getJobTitleURL() { $job = R::load('jobs', $this->_job_id); $job_url = $job->title . ' at ' . $job->company_name; return slugify($job_url); }
function getFileName($date, $title) { return $date . '-' . slugify($title) . '.markdown'; }
/** delete, allows users to delete their own moodboard. Same page used for security, the param can only be passed through a user submitting the original form @param id : id of the moodboard to delete. **/ function delete($id = null) { loggedInSection(); if ($id == null || !is_numeric($id)) { if ($this->input->post("delete_id") !== FALSE) { $mb = $this->moodboard_model->getMoodboard($this->input->post("delete_id")); if ($mb == false) { redirect('', 'location'); } else { $mb = $mb->row(); } if ($this->session->userdata("user_id") == $mb->m_user_id) { // delete database records and delete file if ($this->moodboard_model->deleteMoodboard($mb->moodboard_id)) { redirect("/user/u/" . $this->session->userdata("username") . "/?moodboard_deleted=1", "location"); } else { $data = array("errorTitle" => "Delete Failed", "content" => "An error has occurred when delete the moodboard. Please ensure this is your moodboard. If the problem persists, please get in touch"); $this->template->write_view("content", "general/error", $data, TRUE); //now render templates $this->template->render(); } } else { redirect('', 'location'); } } else { redirect('', 'location'); } } else { $mb = $this->moodboard_model->getMoodboard($id); if ($mb == false) { redirect('', 'location'); } else { $mb = $mb->row(); } if ($this->session->userdata("user_id") == $mb->m_user_id) { $base = base_url(); // now show delete screen $data = array("mb_title" => $mb->m_title, "mb_url" => $base . "moodboard/view/" . $mb->moodboard_id . '/' . slugify($mb->m_title) . '/', "delete_id" => $mb->moodboard_id); $this->template->write("title", "Delete a Moodboard"); $this->template->write_view("content", "moodboard/delete", $data, TRUE); $this->template->render(); } else { redirect('', 'location'); } } }
function u($user) { // determine id or name if (is_numeric($user)) { $query = $this->user_model->getUser($user); } else { $query = $this->user_model->getUser($user, "u_username"); } if ($query !== false) { $row = $query->row(); // some prelim stuff before we load the page: user_profile etc $image_url = getUserProfileURL($row->u_profile_id, $row->u_email); // urika.helper /*** Grabbing User DB stuff **/ $uploads = $this->_getUserUploads($row->user_id, "both"); $favourites = $this->user_model->getUserFavs($row->user_id); $collections = $this->user_model->getUserCollections($row->user_id); $follows = $this->_getUserFollows($row->user_id, "both"); // set up user info string $info_string = ""; if ($row->u_firstname != "") { $info_string .= $row->u_firstname . " " . $row->u_surname; } if ($row->u_website != "") { if ($info_string != "") { $info_string .= ' | '; } $info_string .= '<a class="u_website_link" href="' . $row->u_website . '" title="' . $row->u_username . '\'s website">' . $row->u_website . '</a>'; } if ($row->u_twitter != "") { if ($info_string != "") { $info_string .= ' | '; } $info_string .= '<a class="u_twitter_link" href="http://twitter.com/' . $row->u_twitter . '" title="' . $row->u_username . '\'s twitter">@' . $row->u_twitter . '</a>'; } if ($row->u_location != "") { if ($info_string != "") { $info_string .= ' | '; } $info_string .= $row->u_location; } // folow button stuff $follow_section = ""; if ($row->user_id != $this->session->userdata("user_id") && $this->session->userdata("is_logged_in") == 1) { $already_following = false; //check for already following: for ($j = 0; $j < $follows["followedby"]["count"]; $j++) { if ($follows["followedby"]["result"][$j]->f_follower == $this->session->userdata("user_id")) { $already_following = true; break; } } if ($already_following) { $follow_section = '<a id="profile_unfollow" onclick="deleteFollow(' . $row->user_id . ',' . $this->session->userdata("user_id") . ');" href="#" title="Unfollow ' . $row->u_username . '"><span class="hide">Unfollow ' . $row->u_username . '</span></a>'; } else { $follow_section = '<a id="profile_follow" onclick="addFollow(' . $row->user_id . ');" href="#" title="Follow ' . $row->u_username . '"><span class="hide">Follow ' . $row->u_username . '</span></a>'; } } /* Generate User data from DB records */ $base = base_url(); // Images if ($uploads["images"]["count"] > 0) { $out = '<ul class="uploadList" id="userUploads">'; for ($i = 0; $i < $uploads["images"]["count"]; $i++) { $irow = $uploads["images"]["result"][$i]; // load li through view $data = array("thumb_url" => $irow->i_thumb_url, "title" => $irow->i_title, "url" => $base . 'image/view/' . $irow->image_id . '/' . slugify($irow->i_title) . '/', "user_url" => $base . 'user/u/' . $row->u_username . '/', "username" => $row->u_username, "views" => $irow->i_views, "overlay" => $base . 'assets/images/layout/uploadListOverlay.gif'); $out .= $this->load->view("components/uploadListLi", $data, true); } $out .= '</ul>'; if ($uploads["images"]["total"] > 20) { $out .= ' <div class="pagination_buttons uploads_pagination clear"> <span id="current_uploads_page" class="hide">1</span> <input type="button" class="pagination hide" onclick="userUploadsNav(' . $row->user_id . ',-1,' . $uploads["images"]["total"] . ');" name="uploads_prev" id="uploads_prev" value="< Newer" /> <input type="button" class="pagination" onclick="userUploadsNav(' . $row->user_id . ',1,' . $uploads["images"]["total"] . ');" name="uploads_next" id="uploads_next" value="Older >" /> <span class="loading hide"> </span> </div> '; } $output["images"] = $out; } else { $output["images"] = "No images uploaded"; } //moodboards if ($uploads["mbs"]["count"] > 0) { $out = '<ul class="uploadList" id="userMoodboards">'; for ($i = 0; $i < $uploads["mbs"]["count"]; $i++) { $mrow = $uploads["mbs"]["result"][$i]; // load li through view $data = array("thumb_url" => $mrow->m_thumb_url, "title" => $mrow->m_title, "url" => $base . 'moodboard/view/' . $mrow->moodboard_id . '/' . slugify($mrow->m_title) . '/', "user_url" => $base . 'user/u/' . $row->u_username . '/', "username" => $row->u_username, "views" => $mrow->m_views, "overlay" => $base . 'assets/images/layout/mbListOverlay.gif'); $out .= $this->load->view("components/mbListLi", $data, true); } $out .= '</ul>'; if ($uploads["mbs"]["total"] > 20) { $out .= ' <div class="pagination_buttons mbs_pagination clear"> <span id="current_mbs_page" class="hide">1</span> <input type="button" class="pagination hide" onclick="userMBsNav(' . $row->user_id . ',-1,' . $uploads["mbs"]["total"] . ');" name="mbs_prev" id="mbs_prev" value="< Newer" /> <input type="button" class="pagination" onclick="userMBsNav(' . $row->user_id . ',1,' . $uploads["mbs"]["total"] . ');" name="mbs_next" id="mbs_next" value="Older >" /> <span class="loading hide"> </span> </div> '; } $output["moodboards"] = $out; } else { if ($this->session->userdata("user_id") !== FALSE && $this->session->userdata("user_id") == $row->user_id) { $output["moodboards"] = ' <div class="borderbox" id="collectionIntro"> <p> <strong>You don\'t have any moodboards yet!</strong> Moodboards are collages built from images in your collections, ideal for showing clients or brainstorming ideas. UR!KA lets you arrange images in any order, size or rotation to make your ideal moodboard!<br/><br/> </p> <p> If you already have <strong>Collections</strong>, simply click on a collection then <strong>Create Moodboard</strong> to get started, it\'s that easy! Otherwise, head over to the collections tab and create a collection first! </p> </div> '; } else { $output["moodboards"] = 'No Moodboards Yet'; } } // favourites if ($favourites["count"] > 0) { $out = '<ul class="uploadList" id="userFavs">'; for ($i = 0; $i < $favourites["count"]; $i++) { $irow = $favourites["result"][$i]; if ($irow->f_type == "image") { // load li through view $data = array("thumb_url" => $irow->i_thumb_url, "title" => $irow->i_title, "url" => $base . 'image/view/' . $irow->image_id . '/' . slugify($irow->i_title) . '/', "user_url" => $base . 'user/u/' . $irow->u_username . '/', "username" => $irow->u_username, "views" => $irow->i_views, "overlay" => $base . 'assets/images/layout/uploadListOverlay.gif'); $out .= $this->load->view("components/uploadListLi", $data, true); } else { if ($irow->f_type == "moodboard") { // load li through view $data = array("thumb_url" => $irow->m_thumb_url, "title" => $irow->m_title, "url" => $base . 'moodboard/view/' . $irow->moodboard_id . '/' . slugify($irow->m_title) . '/', "user_url" => $base . 'user/u/' . $row->u_username . '/', "username" => $row->u_username, "views" => $irow->m_views, "overlay" => $base . 'assets/images/layout/mbListOverlay.gif'); $out .= $this->load->view("components/mbListLi", $data, true); } } } $out .= '</ul>'; if ($favourites["total"] > 20) { $out .= ' <div class="pagination_buttons favourites_pagination clear"> <span id="current_favourites_page" class="hide">1</span> <input type="button" class="pagination hide" onclick="userFavsNav(' . $row->user_id . ',-1,' . $favourites["total"] . ');" name="favs_prev" id="favs_prev" value="< Newer" /> <input type="button" class="pagination" onclick="userFavsNav(' . $row->user_id . ',1,' . $favourites["total"] . ');" name="favs_next" id="favs_next" value="Older >" /> <span class="loading hide"> </span> </div> '; } $output["favourites"] = $out; } else { $output["favourites"] = "No favourites added"; } // collections if ($collections["count"] > 0) { $out = ""; $this->load->model("collection_model"); $out .= '<ul class="bigCollectionsList">'; for ($i = 0; $i < $collections["count"]; $i++) { $irow = $collections["result"][$i]; $images = $this->collection_model->getCollectionImages($irow->collection_id, true); $images_html = ""; if ($images != false) { for ($j = 0; $j < 4; $j++) { if (isset($images[$j])) { $images_html .= '<img src="' . $images[$j]->i_thumb_url . '" width="94" height="94" alt="Thumbnail image for a memer of this collection" />'; } } } else { $images_html = "<em>No Images added</em>"; } $ids_array = explode(",", $irow->col_string); if ($ids_array[0] == "") { $image_count = 0; } else { $image_count = count($ids_array); } // load li through view $view_data = array("collection_id" => $irow->collection_id, "collection_name" => $irow->col_name, "collection_url" => $base . 'collection/view/' . $irow->collection_id . '/' . slugify($irow->col_name) . '/', "collection_update" => date("F j, Y, G:i", strtotime($irow->col_updated)), "collection_user" => $row->u_username, "collection_images" => $images_html, "collection_image_count" => $image_count . ' images', "style" => ' '); $out .= $this->load->view("components/collectionsLi", $view_data, true); } $out .= '</ul>'; if ($row->user_id == $this->session->userdata("user_id") && $this->session->userdata("is_logged_in") == 1) { $out .= ' <div> <input type="button" class="forceStyle" name="addCollection" id="addCollection" value="Add a Collection" /> </div> <div id="createCollectionForm" class="hide"> <ul> <li> <label for="newcol_name">Collection Name:</label> <input type="text" name="newcol_name" class="newcol_name" /> </li> <li> <input type="button" name="saveNewCollection" id="saveNewCollection" onclick="addCollection()" value="Save Collection" /> <span class="loading hide"> </span> </li> </ul> </div> '; } $output["collections"] = $out; } else { if ($this->session->userdata("user_id") !== FALSE && $this->session->userdata("user_id") == $row->user_id) { $output["collections"] = ' <div class="borderbox" id="collectionIntro"> <p> <strong>You don\'t have any collections yet!</strong> Collections let you group similar uploads that you find on UR!KA e.g. good examples of navigation. You can build <strong>Moodboards</strong> from Collections! Click the button below to start you first collection. </p> <p> <br /> <input type="button" name="addCollection" id="addCollection" value="Create a Collection" /> </p> </div> <div id="createCollectionForm" class="hide"> <ul> <li> <label for="newcol_name">Collection Name:</label> <input type="text" name="newcol_name" class="newcol_name" /> </li> <li> <input type="button" name="saveNewCollection" id="saveNewCollection" onclick="addCollection()" value="Save Collection" /> <span class="loading hide"> </span> </li> </ul> </div> <ul class="bigCollectionsList"> </ul> '; } else { $output["collections"] = 'No Collections Yet'; } } // Follows if ($follows["follows"]["count"] > 0) { $out = '<ul class="smallUserList" id="followingList">'; for ($i = 0; $i < 10; $i++) { if (isset($follows["follows"]["result"][$i])) { $urow = $follows["follows"]["result"][$i]; $fimage_url = getUserProfileURL($urow->u_profile_id, $urow->u_email); // urika.helper $profilelink = $base . 'user/u/' . $urow->u_username . '/'; $lidata = array("user_id" => $urow->user_id, "profile_link" => $profilelink, "profile_img" => $fimage_url, "username" => $urow->u_username); $out .= $this->load->view("components/smallUserListLi", $lidata, true); } } $out .= '</ul>'; if ($follows["follows"]["count"] > 9) { $out .= '<a class="follow_view_all" href="' . $base . 'user/ulist/?followed_by=' . $row->u_username . '">View All Following</a>'; } $output["follows"] = $out; } else { $output["follows"] = "No following"; } // Followed By // for now imaes are all gravatars if ($follows["followedby"]["count"] > 0) { $out = '<ul class="smallUserList" id="followersList">'; for ($i = 0; $i < 10; $i++) { if (isset($follows["followedby"]["result"][$i])) { $urow = $follows["followedby"]["result"][$i]; $fimage_url = getUserProfileURL($urow->u_profile_id, $urow->u_email); $base = base_url(); $profilelink = $base . 'user/u/' . $urow->u_username . '/'; $lidata = array("user_id" => $urow->user_id, "profile_link" => $profilelink, "profile_img" => $fimage_url, "username" => $urow->u_username); $out .= $this->load->view("components/smallUserListLi", $lidata, true); } } $out .= '</ul>'; if ($follows["followedby"]["count"] > 9) { $out .= '<a class="follow_view_all" href="' . $base . 'user/ulist/?following=' . $row->u_username . '">View All Followers</a>'; } $output["followedby"] = $out; } else { $output["followedby"] = "No followers"; } $data = array("username" => $row->u_username, "image_url" => $image_url, "info_string" => $info_string, "follow_section" => $follow_section, "user_count" => array('images' => $uploads["images"]["total"], 'mbs' => $uploads["mbs"]["total"], 'favs' => $favourites["total"], 'collections' => $collections["count"], 'follows' => $follows["follows"]["count"], 'followedby' => $follows["followedby"]["count"]), "output" => $output); //now render templates $this->template->write("title", $row->u_username . "'s Profile"); $this->template->add_js("assets/js/tabs.js"); $this->template->add_js("assets/js/ajax.js"); $this->template->write_view("content", "user/profile", $data, TRUE); $this->template->render(); } else { redirect('user/ulist/?usernotfound=' . $user, 'location'); // go to user list? } }
*/ // Clean function // code derived from http://php.vrana.cz/vytvoreni-pratelskeho-url.php function slugify($text) { // replace non letter or digits by - $text = preg_replace('#[^\\pL\\d]+#u', '-', $text); // trim $text = trim($text, '-'); // transliterate if (function_exists('iconv')) { $text = iconv('utf-8', 'us-ascii//TRANSLIT', $text); } // lowercase $text = strtolower($text); // remove unwanted characters $text = preg_replace('#[^-\\w]+#', '', $text); if (empty($text)) { return 'n-a'; } return $text; } // We rename each of uploaded files foreach ($files as $file) { if ($file['error'] == 0) { $pathInfo = pathinfo($file['name']); $oldPath = $directory . $file['name']; $newPath = slugify($pathInfo['filename']) . '-' . uniqid() . '.' . $pathInfo['extension']; $source->renameObject($oldPath, $newPath); } }
<script type="text/javascript" src="<?php echo site_url(); ?> /media/js/flowplayer-3.2.6.min.js"></script> <script type="text/javascript" src="<?php echo site_url(); ?> /media/js/flowplayer.ipad-3.2.2.min.js"></script> <?php $id_video = $this->input->get('id_video'); $videodata = $this->mod_io_m->init('id_video', $id_video, TBL_VIDEO); $video_url = $this->hentai_m->getFacebookVideoSource($id_video); $seriesdata = $this->mod_io_m->init('id_series', $videodata->id_series, TBL_SERIES); $slug = slugify($seriesdata->name); $full_url = site_url("user/hentai/series/{$videodata->id_series}/{$slug}"); ?> <div class="cls-photo-gallery"> <div id="hentai_vid_div" align="center"> <!--<a href="" style="display:block;width:520px;height:330px" id="video_player"></a>--> <a style="display:block; width:640px; height:360px;" id="ipad"></a> <?php if (!$video_url) { echo "This video does not exist."; exit; } ?>