function print_books($books, $is_large = false) { echo '<ul class="book_icons">'; foreach ($books as $row) { $uri = confirm_slash(base_url()) . $row->slug; $title = trim($row->title); $book_id = (int) $row->book_id; $thumbnail = !empty($row->thumbnail) ? confirm_slash($row->slug) . $row->thumbnail : null; $is_live = $row->display_in_index ? true : false; if (empty($thumbnail) || !file_exists($thumbnail)) { $thumbnail = path_from_file(__FILE__) . 'default_book_logo.png'; } $authors = array(); foreach ($row->users as $user) { if ($user->relationship != strtolower('author')) { continue; } if (!$user->list_in_index) { continue; } $authors[] = $user->fullname; } echo '<li><a href="' . $uri . '"><img class="book_icon' . ($is_large ? '' : ' small') . '" src="' . confirm_base($thumbnail) . '" /></a><h4><a href="' . $uri . '">' . $title . '</a></h4>'; if (count($authors)) { echo implode(', ', $authors); echo "<br />"; } echo '</li>'; } echo '</ul>'; }
function print_books($books, $cols, $tab_cols, $mob_cols, $user_id) { if (!isset($tab_cols)) { $tab_cols = $cols; } if (!isset($mob_cols)) { $mob_cols = $tab_cols; } $num_books = count($books); echo '<div class="original book_list row">'; foreach ($books as $i => $row) { $uri = confirm_slash(base_url()) . $row->slug; $title = trim(strip_tags($row->title)); $book_id = (int) $row->book_id; $thumbnail = !empty($row->thumbnail) ? confirm_slash($row->slug) . $row->thumbnail : null; $is_live = $row->display_in_index && $row->url_is_public; $is_featured = @$row->is_featured ? true : false; if (empty($thumbnail) || !file_exists(FCPATH . $thumbnail)) { $thumbnail = 'system/application/views/modules/aclsworkbench_book_list/default_book_logo.png'; } $thumbnail = base_url() . $thumbnail; $authors = array(); $user_is_reader = false; foreach ($row->users as $user) { if (isset($user_id) && $user->relationship != strtolower('author')) { if ($user->user_id == $user_id) { $user_is_reader = true; } continue; } if (!$user->list_in_index) { continue; } $authors[] = $user->fullname; } echo '<div data-book_id="', $book_id, '" class="book_container col-md-' . round(12 / $cols) . ' col-sm-' . round(12 / $tab_cols) . ' col-xs-' . round(12 / $mob_cols) . '"> <div class="book center-block', $is_featured ? ' featured' : '', '" ><div class="cover" style="background-image: url(', $thumbnail, ')"><a href="', $uri, '">', $is_featured ? '<p class="bg-primary text-center"><span class="glyphicon glyphicon-star"></span> Featured</p>' : '', $user_is_reader ? '<p class="bg-success text-center"><span class="glyphicon glyphicon-check"></span> Joined</p>' : '', $is_live ? '' : '<p class="bg-danger text-center"><small><span class="glyphicon glyphicon-eye-close"></span> Not Published</small></p>', '</a></div>', '</div>'; if (isset($row->data['duplicatable']) && $row->data['duplicatable'] == 'true' || !$row->current_user && (!isset($row->data['joinable']) || !in_array($row->data['joinable'], array('false', '0'))) || $row->current_user && !$user_is_reader) { echo '<div class="text-center"><div class="btn-group">'; if (isset($row->data['duplicatable']) && $row->data['duplicatable'] == 'true') { echo '<button class="clone btn btn-sm btn-primary" data-id="', $book_id, '" data-title="', $title, '" data-uri="', $uri, '"></i><small>Clone</small></button>'; } if (!$row->current_user && (!isset($row->data['joinable']) || !in_array($row->data['joinable'], array('false', '0')))) { echo '<button class="join btn btn-sm btn-primary" data-id="', $book_id, '" data-title="', $title, '" data-uri="', $uri, '"><small>Join</small></button>'; } else { if ($row->current_user && !$user_is_reader) { echo '<a class="btn btn-sm btn-primary" href="', base_url(), 'system/dashboard?book_id=', $book_id, '&zone=style#tabs-style"><small>Edit</small></a>'; } } echo '</div></div>'; } echo '<h4 class="title text-center"><a href="', $uri, '">', $row->title, '</a><br /><small class="authors">', implode(', ', $authors), '</small></h4> </div>'; if (($i + 1) % $cols == 0) { echo '</div><div class="book_list row">'; } } echo '</div>'; }
public function __construct() { require_once confirm_slash(FCPATH) . 'system/application/libraries/Image_IPTC/Image_IPTC.php'; $CI =& get_instance(); $namespaces = $CI->config->item('namespaces'); $ontologies = $CI->config->item('ontologies'); $this->iptc_uri = @$namespaces[$this->iptc_ns]; $this->iptc = $ontologies[$this->iptc_ns]; }
function abs_url($url, $prefix = '') { if (empty($url)) { return null; } if (strstr($url, '://')) { return $url; } return confirm_slash($prefix) . $url; }
public function __construct($data = array()) { if (!empty($data['book'])) { $this->rdf_url_json = confirm_slash(base_url()) . $data['book']->slug . '/rdf/instancesof/content?format=json&rec=1&ref=1'; $this->rdf_url_xml = confirm_slash(base_url()) . $data['book']->slug . '/rdf/instancesof/content?&rec=1&ref=1'; $this->dest_url = confirm_slash(base_url()) . $data['book']->slug; $this->email = $data['login']->email; $this->source_url = isset($_REQUEST['source_url']) && !empty($_REQUEST['source_url']) ? $_REQUEST['source_url'] : ''; } }
public function reset_password($email = '', $reset_string = '') { $this->CI->email->from('no-reply@' . $this->domain_name(), $this->install_name()); $this->CI->email->reply_to($this->replyto_address(), $this->replyto_name()); $this->CI->email->to($email); $this->CI->email->subject($this->CI->lang->line('email.forgot_password_subject')); $msg = $this->CI->lang->line('email.forgot_password_intro'); $msg .= confirm_slash(base_url()) . 'system/create_password?key=' . $reset_string . "\n\n"; $msg .= $this->CI->lang->line('email.forgot_password_outro'); $this->CI->email->message($msg); if (!$this->CI->email->send()) { throw new Exception('Could not send email. Please try again or contact an administrator.'); } return true; }
public function __construct($data = array()) { $this->plugin_path = strtolower(get_class($this)) . '/index.html'; $this->plugin_dir = dirname(__FILE__) . '/' . $this->plugin_path; if (file_exists($this->plugin_dir)) { $this->plugin_exists = true; } if (!empty($data['book'])) { $this->rdf_url_json = confirm_slash(base_url()) . $data['book']->slug . '/rdf/instancesof/content?format=json&rec=1&ref=1'; $this->rdf_url_xml = confirm_slash(base_url()) . $data['book']->slug . '/rdf/instancesof/content?&rec=1&ref=1'; $this->dest_url = confirm_slash(base_url()) . $data['book']->slug; $this->email = $data['login']->email; $this->source_url = isset($_REQUEST['source_url']) && !empty($_REQUEST['source_url']) ? $_REQUEST['source_url'] : ''; } }
public function new_comment($book, $data = array(), $is_live = false) { $title = @trim($data['title']); $description = @trim($data['description']); $content = @trim($data['content']); $book_url = confirm_slash(base_url()) . $book->slug; $book_title = @strip_tags($book->title); $msg = ''; $arr = array(); if (!empty($title)) { $msg .= '<b>' . $title . '</b>' . "\n"; } if (!empty($description)) { $msg .= $description . "\n"; } if (!empty($content)) { $msg .= $content . "\n\n"; } $author_emails = array(); foreach ($book->contributors as $author) { if (strtolower($author->relationship) != 'author') { continue; } $author_emails[] = $author->email; } if (empty($author_emails)) { return false; } $arr['from'] = 'no-reply@' . $this->domain_name(); $arr['fromName'] = $this->install_name(); $arr['to'] = $author_emails; $arr['replyTo'] = $this->replyto_address(); $arr['replyToName'] = $this->replyto_name(); $arr['subject'] = sprintf($this->CI->lang->line('email.new_comment_subject'), $book_title); $arr['msg'] = sprintf($this->CI->lang->line('email.new_comment_intro'), $book_title) . "\n\n"; $arr['msg'] .= $msg; $arr['msg'] .= $is_live ? $this->CI->lang->line('email.new_comment_outro') . "\n" : $this->CI->lang->line('email.new_comment_outro_moderated') . "\n"; $arr['msg'] .= '<a href="' . $book_url . '">' . $book_url . '</a>' . "\n\n"; $arr['msg'] .= $this->CI->lang->line('email.new_comment_footer'); $this->send($arr); return true; }
public function create_directory_from_slug($slug = '') { if (!mkdir($slug)) { throw new Exception('There was a problem creating the ' . $slug . ' folder on the filesystem.'); } if (!mkdir(confirm_slash($slug) . 'media')) { echo 'Alert: could not create media folder for ' . $slug . '.'; } chmod($slug, 0777); chmod(confirm_slash($slug) . 'media', 0777); }
private function resize($targetFile, $width) { require confirm_slash(APPPATH) . 'libraries/wideimage/WideImage.php'; WideImage::load($targetFile)->resize($width)->saveToFile($targetFile); }
}); }); // Remove versions } else { var $next = $the_link.parent().parent().next(); if ($next.hasClass('version_wrapper')) $next.remove(); $the_link.html('View'); $the_link.data('is_open',false); $the_link.blur(); } } </script> <a href="<?php echo confirm_slash(base_url()) . confirm_slash($book->slug); ?> new.edit" style="float:right;font-size:11px !important;" class="generic_button">Create new page</a> <form style="float:left;" id="formSearch"> <input type="text" name="sq" style="width:300px;float:left;margin-right:3px;" class="generic_text_input" value="Search for a page" onmousedown="if (this.value=='Search for a page') this.value='';" /> <input type="submit" value="Go" class="generic_button" /> <a href="javascript:;">clear</a> <?php if (count($current_book_content)) { ?> <span class="prev"></span> <span class="pagination"></span> <b class="total"><?php echo count($current_book_content); ?> </b> page<?php echo $current_book_content > 1 ? 's' : ''; ?>
public function save($array = array()) { // Get ID $content_id = (int) $array['id']; if (empty($content_id)) { throw new Exception('Could not resolve content ID'); } unset($array['id']); unset($array['section']); unset($array['ci_session']); if (isset($array['color']) && $array['color'] == '#ffffff') { $array['color'] = ''; } // If the slug has changed... if (isset($array['slug'])) { // Get previous slug $this->db->select('slug'); $this->db->from($this->pages_table); $this->db->where('content_id', $content_id); $query = $this->db->get(); $result = $query->result(); if (!isset($result[0])) { throw new Exception('Could not find book'); } $slug = $result[0]->slug; // Get book slug $this->db->select($this->books_table . '.slug'); $this->db->select($this->books_table . '.book_id'); $this->db->from($this->pages_table); $this->db->join($this->books_table, $this->books_table . '.book_id=' . $this->pages_table . '.book_id'); $this->db->where($this->pages_table . '.content_id', $content_id); $query = $this->db->get(); $result = $query->result(); if (!isset($result[0])) { throw new Exception('Could not find book'); } $book_slug = $result[0]->slug; $book_id = (int) $result[0]->book_id; // Scrub slug if (!function_exists('safe_name')) { $ci = get_instance(); $ci->load->helper('url'); } $array['slug'] = safe_name($array['slug']); $array['slug'] = $this->safe_slug($array['slug'], $book_id, $content_id); // Rewrite URLs in book text content // This is most likely not to be completely trusted but if working properly provides a userful service to authors since linking is important in Scalar if ($array['slug'] != $slug) { // TODO: test for safety on the slug rename $this->db->select($this->versions_table . '.version_id'); $this->db->from($this->versions_table); $this->db->join($this->pages_table, $this->versions_table . '.content_id=' . $this->pages_table . '.content_id'); $this->db->join($this->books_table, $this->pages_table . '.book_id=' . $this->books_table . '.book_id'); $this->db->where($this->books_table . '.book_id', $book_id); $query = $this->db->get(); if ($query->num_rows()) { $dbprefix = $this->db->dbprefix; // Since we're using a custom MySQL query below if (empty($dbprefix)) { die('Could not resolve DB prefix. Nothing has been saved. Please try again'); } $book_version_ids = array(); $result = $query->result(); foreach ($result as $row) { $book_version_ids[] = $row->version_id; } if (!empty($book_version_ids)) { // Update hard URLs in version contet $old = confirm_slash(base_url()) . confirm_slash($book_slug) . $slug; $new = confirm_slash(base_url()) . confirm_slash($book_slug) . $array['slug']; $query = $this->db->query("UPDATE " . $dbprefix . $this->versions_table . " SET content = replace(content, '{$old}', '{$new}') WHERE version_id IN (" . implode(',', $book_version_ids) . ")"); // Update soft URLs in version contet - href $old = 'href="' . $slug . '"'; $new = 'href="' . $array['slug'] . '"'; $query = $this->db->query("UPDATE " . $dbprefix . $this->versions_table . " SET content = replace(content, '" . addslashes($old) . "', '" . addslashes($new) . "') WHERE version_id IN (" . implode(',', $book_version_ids) . ")"); // Update soft URLs in version contet - resource $old = 'resource="' . $slug . '"'; $new = 'resource="' . $array['slug'] . '"'; $query = $this->db->query("UPDATE " . $dbprefix . $this->versions_table . " SET content = replace(content, '" . addslashes($old) . "', '" . addslashes($new) . "') WHERE version_id IN (" . implode(',', $book_version_ids) . ")"); } } } } // isset $array['slug'] // Save row $this->db->where('content_id', $content_id); $this->db->update($this->pages_table, $array); return $array; }
?> " /> <input type="hidden" name="api_key" value="0" /> <input type="hidden" name="child_urn" value="<?php echo $book->urn; ?> " /> <input type="hidden" name="child_type" value="http://scalar.usc.edu/2012/01/scalar-ns#Book" /> <input type="hidden" name="child_rel" value="page" /> </form> <p id="loading"><img src="<?php echo confirm_slash($app_root); ?> views/melons/honeydew/images/loading.gif"" height="16" align="absmiddle" /> Searching the archive (may take a moment)</p> <div id="results"></div> <div class="search_results_footer"><img src="<?php echo confirm_slash($app_root); ?> views/melons/honeydew/images/loading.gif"" height="16" align="absmiddle" /> <a class="generic_button large default" href="javascript:;" onclick="search_archive_import();">Import selected media</a></div> <br clear="both" /> <?php } ?> </div>
<?php if (!file_exists(confirm_slash(APPPATH) . 'views/melons/honeydew/content/' . $view . '.php')) { show_404(); } $this->template->add_css(path_from_file(__FILE__) . '../../modules/cover/login.css'); $this->template->add_css(path_from_file(__FILE__) . '../../modules/cover/title.css'); $this->template->add_css(path_from_file(__FILE__) . 'content.css'); if (isset($book->stylesheet) && !empty($book->stylesheet)) { $this->template->add_css(path_from_file(__FILE__) . 'themes/' . $book->stylesheet . '.css'); } $this->template->add_js(path_from_file(__FILE__) . 'main.js'); $this->load->view('melons/honeydew/content/' . $view);
echo '<a href="' . confirm_slash(base_url()) . $book->slug . '">'; echo empty($title) ? htmlspecialchars('<title missing>') : $title; echo '</a>'; if (isset($book->contributors)) { if (function_exists('sort_contributors')) { usort($book->contributors, 'sort_contributors'); } $contribs = array(); foreach ($book->contributors as $row) { if ('author' == $row->relationship && $row->list_in_index) { $contribs[] = $row->fullname; } } if (count($contribs)) { echo ' by ' . implode(' and ', $contribs); } } if (isset($book) && !empty($book)) { echo '. <a href="' . confirm_slash(base_url()) . confirm_slash($book->slug) . 'help">Help reading this ' . $book->scope . '</a>.</span><br />' . "\n"; } // Publisher and license echo '<span class="poweredby">' . "\n"; if (!empty($book->publisher)) { echo 'Published by ' . $book->publisher . '. '; } echo 'Powered by <a href="http://scalar.usc.edu">Scalar</a>.<br /><a href="http://scalar.usc.edu/terms-of-service/">Terms of Service</a> | <a href="http://scalar.usc.edu/privacy-policy/">Privacy Policy</a> | <a href="http://scalar.usc.edu/contact/">Scalar Feedback</a>'; echo "</span>\n"; echo "</div>\n"; // logo wrapper echo "</div>\n"; // footer_content
</tr> <tr class="styling_sub"><!-- color --> <td>Color<br /><small>e.g., for path nav bar</small></td> <td><input style="width:100%;" type="text" id="color_select" name="scalar:color" value="<?php echo !empty($page->color) ? $page->color : '#ffffff'; ?> " /></td> <td class="styling_last"> <a href="javascript:;" class="generic_button" onclick="$(this).next().toggle();">Choose</a> <div style="display:none;margin-top:6px;"><div id="colorpicker"></div></div> </td> </tr> <tr class="styling_sub"><!-- background image --> <td>Background image</td> <td><?php echo @(!empty($page->background)) ? '<img src="' . abs_url($page->background, confirm_slash(base_url()) . confirm_slash($book->slug)) . '" class="thumb_preview" />' : 'No background image has been set'; ?> </td> <td class="styling_last"><select name="scalar:background"><option value="">Choose an uploaded image</option><?php $matched = false; foreach ($book_images as $book_image_row) { if (@$page->background == $book_image_row->versions[$book_image_row->version_index]->url) { $matched = true; } $slug_version = get_slug_version($book_image_row->slug); echo '<option value="' . $book_image_row->versions[$book_image_row->version_index]->url . '" ' . (@$page->background == $book_image_row->versions[$book_image_row->version_index]->url ? 'selected' : '') . '>' . $book_image_row->versions[$book_image_row->version_index]->title . (!empty($slug_version) ? ' (' . $slug_version . ')' : '') . '</option>'; } if (!$matched) { echo '<option value="' . @$page->background . '" selected>' . @$page->background . '</option>'; } ?>
private function upload() { $action = isset($_POST['action']) ? strtolower($_POST['action']) : null; $chmod_mode = $this->config->item('chmod_mode'); if (empty($chmod_mode)) { $chmod_mode = 0777; } if (!$this->login_is_book_admin('Commentator')) { if ($action == 'add') { echo json_encode(array('error' => 'Not logged in or not an author')); } else { $this->require_login(4); } exit; } $this->data['view'] = __FUNCTION__; if (empty($_FILES) && empty($_POST) && isset($_SERVER['REQUEST_METHOD']) && 'post' == strtolower($_SERVER['REQUEST_METHOD'])) { echo json_encode(array('error' => 'The file is larger than the server\'s max upload size')); exit; } elseif ($action == 'add' || $action == 'replace') { $return = array(); try { $slug = confirm_slash($this->data['book']->slug); $url = $this->file_upload->uploadMedia($slug, $chmod_mode, $this->versions); $path = confirm_slash(FCPATH) . confirm_slash($this->data['book']->slug) . $url; $thumbUrl = $this->file_upload->createMediaThumb($slug, $url, $chmod_mode); } catch (Exception $e) { $return['error'] = $e->getMessage(); echo json_encode($return); exit; } try { $this->load->library('Image_Metadata', 'image_metadata'); $return[$url] = $this->image_metadata->get($path, Image_Metadata::FORMAT_NS); } catch (Exception $e) { // Don't throw exception since this isn't critical } if (false !== $thumbUrl) { $return[$url]['scalar:thumbnail'] = confirm_slash(base_url()) . $slug . $thumbUrl; } echo json_encode($return); exit; } // if // List of media pages $this->data['book_media'] = $this->pages->get_all($this->data['book']->book_id, 'media', null, false); $to_remove = array(); for ($j = 0; $j < count($this->data['book_media']); $j++) { $this->data['book_media'][$j]->versions = array(); $this->data['book_media'][$j]->versions[0] = $this->versions->get_single($this->data['book_media'][$j]->content_id, null, $this->data['book_media'][$j]->recent_version_id); } }
$this->template->add_js('system/application/views/widgets/edit/jquery.content_selector.js'); if (empty($book)) { echo 'Please select a book to manage using the pulldown menu above'; } else { $default_rel_type = 'term'; // Make comments default for easy access to hidden comments ?> <div id="slug-change-confirm" title="URI change"> Changing the page's URI will change its location on the web, which will make its old URL unavailable. Do you wish to continue? </div> <script> var book_uri = '<?php echo addslashes(confirm_slash(base_url()) . confirm_slash($book->slug)); ?> '; var book_id = <?php echo $book->book_id; ?> ; $(document).ready(function() { rel_type = $('#formRelType').find('[name="relType"] option:selected').val(); // Global $('#check_all').click(function() { var check_all = ($(this).is(':checked')) ? true : false; $('.table_wrapper').find('input[type="checkbox"]').prop('checked', check_all); });
/** * URL information and load the current book */ public function __construct() { parent::__construct(); $this->load->model('book_model', 'books'); $this->load->model('page_model', 'pages'); $this->load->model('version_model', 'versions'); $this->load->model('reference_model', 'references'); $this->load->model('annotation_model', 'annotations'); $this->load->model('path_model', 'paths'); $this->load->model('tag_model', 'tags'); $this->load->model('reply_model', 'replies'); $this->load->library('RDF_Object', 'rdf_object'); $this->load->library('statusCodes'); $this->load->helper('inflector'); $this->models = $this->config->item('rel'); // Determine the current book being asked for (if applicable) $this->scope = strtolower(get_class($this)) == strtolower($this->uri->segment('1')) ? null : strtolower($this->uri->segment('1')); // Load book beind asked for (if applicable) $this->data['book'] = !empty($this->scope) ? $this->books->get_by_slug($this->scope) : null; if (empty($this->data['book'])) { // Book couldn't be found $this->data['base_uri'] = confirm_slash(base_url()); } else { // Book was found $this->data['base_uri'] = confirm_slash(base_url()) . confirm_slash($this->data['book']->slug); // Protect book; TODO: provide api_key authentication like api.php $this->set_user_book_perms(); if (!$this->data['book']->url_is_public && !$this->login_is_book_admin('reader')) { header(StatusCodes::httpHeaderFor(StatusCodes::HTTP_NOT_FOUND)); exit; } } // Format (e.g., 'xml', 'json') $allowable_formats = array('xml' => 'xml', 'json' => 'json', 'rdfxml' => 'xml', 'rdfjson' => 'json', 'turtle' => 'turtle'); $this->data['format'] = isset($_REQUEST['format']) && array_key_exists($_REQUEST['format'], $allowable_formats) ? $allowable_formats[$_REQUEST['format']] : $allowable_formats[key($allowable_formats)]; $ext = get_ext($this->uri->uri_string()); $this->data['format'] = !empty($ext) && array_key_exists($ext, $allowable_formats) ? $allowable_formats[$ext] : $this->data['format']; // Recursion level $this->data['recursion'] = isset($_REQUEST['rec']) && is_numeric($_REQUEST['rec']) ? (int) $_REQUEST['rec'] : 0; // Display references? $this->data['references'] = isset($_REQUEST['ref']) && $_REQUEST['ref'] ? true : false; // Restrict relationships to a certain relationship or set of relationships (seperated by a comma)? $this->data['restrict'] = array(); $restrict = isset($_REQUEST['res']) && !empty($_REQUEST['res']) ? explode(',', $_REQUEST['res']) : array(); foreach ($restrict as $res) { if (!in_array(plural(strtolower($res)), $this->models)) { continue; } $this->data['restrict'][] = (string) plural(strtolower($res)); } // Display all versions? $this->data['versions'] = isset($_REQUEST['versions']) && $_REQUEST['versions'] ? true : false; // Search terms $this->data['sq'] = isset($_REQUEST['sq']) && !empty($_REQUEST['sq']) ? search_split_terms($_REQUEST['sq']) : null; // Provenance $this->data['provenance'] = isset($_REQUEST['prov']) && !empty($_REQUEST['prov']) ? 1 : null; // Show hidden content $this->data['hidden'] = isset($_REQUEST['hidden']) && !empty($_REQUEST['hidden']) ? (int) $_REQUEST['hidden'] : 0; $this->set_user_book_perms(); if (!$this->data['login'] || !$this->login_is_book_admin()) { $this->data['hidden'] = 0; } // Pagination $start = isset($_REQUEST['start']) ? (int) $_REQUEST['start'] : null; $results = isset($_REQUEST['results']) && !empty($_REQUEST['results']) ? (int) $_REQUEST['results'] : null; if (empty($results)) { $start = $results = null; } $this->data['pagination'] = array(); if (!empty($start) || $start === 0) { $this->data['pagination']['start'] = $start; } if (!empty($results)) { $this->data['pagination']['results'] = $results; } }
public function foaf_homepage($value, $base_uri) { if (isURL($value)) { return $value; } return confirm_slash($base_uri) . 'users/' . $value; }
/** * Parse RDF, either from a string or a URL */ public function parse($url) { $parser = @ARC2::getRDFXMLParser(); if (stristr($url, '<rdf')) { $parser->parse(confirm_slash(base_url()), $url); // Parse an existing string } else { @$parser->parse($url); // Go out and get via the URL } $index = $parser->getSimpleIndex(0); return $index; }
public function __construct() { parent::__construct(); $this->login_basename = confirm_slash(base_url()); }
private function _system_by_ref(&$return, $settings) { $CI =& get_instance(); if ('object' != gettype($CI->books)) { $CI->load->model('book_model', 'books'); } $settings = $this->_settings($settings); foreach ($settings['books'] as $row) { if (!isset($settings['content']->has_part)) { $settings['content']->has_part = array(); } $settings['content']->has_part[] = $settings['base_uri'] . $row->slug; } $return[rtrim($settings['base_uri'], '/')] = $CI->books->rdf($settings['content']); // Book nodes foreach ($settings['books'] as $row) { unset($row->users); if (isset($row->thumbnail) && !empty($row->thumbnail)) { $row->thumbnail = $settings['base_uri'] . confirm_slash($row->slug) . $row->thumbnail; } $return[$settings['base_uri'] . $row->slug] = $CI->books->rdf($row, $settings['base_uri']); } }
var $row = $('<tr class="version_wrapper"><td colspan="9" style="padding:0px 0px 0px 0px;"><table style="width:100%;" cellspacing="0" cellpadding="0"></table></td></tr>'); var $header = ('<tr><th>ID</th><th>Version</th><th>Title</th><th>Description</th><th>Content</th><th>User</th><th>Created</th></tr>'); $row.find('table').html($header); $the_row.after($row); for (var j in data) { var $page_row = $('<tr class="header" id="content_row_'+data[j].content_id+'" typeof="pages"><td colspan="7"><a href="<?php echo confirm_slash(base_url()) . @$book->slug; ?> /'+data[j].slug+'">'+data[j].slug+'</a></td></tr>'); $row.find('table').find('tr:last').after($page_row); for (var k in data[j].versions) { var $version_row = $('<tr class="'+((user_id==data[j].versions[k].user)?'hl':'')+'" id="version_row_'+data[j].versions[k].version_id+'" typeof="versions"></tr>'); $version_row.append('<td property="id">'+data[j].versions[k].version_id+"</td>"); $version_row.append('<td property="version_num">'+data[j].versions[k].version_num+"</td>"); $version_row.append('<td property="title"><a href="<?php echo confirm_slash(base_url()) . @$book->slug; ?> /'+data[j].slug+'.'+data[j].versions[k].version_num+'">'+data[j].versions[k].title+"</a></td>"); $version_row.append('<td property="description"><span class="full">'+data[j].versions[k].description+'</span><span class="clip">'+create_excerpt(data[j].versions[k].description,8)+'</span></td>'); $version_row.append('<td property="content"><span class="full">'+data[j].versions[k].content+'</span><span class="clip">'+create_excerpt(data[j].versions[k].content,8)+'</span></td>'); $version_row.append('<td property="user">'+data[j].versions[k].user+"</td>"); $version_row.append('<td property="created" style="white-space:nowrap;">'+data[j].versions[k].created+"</td>"); $row.find('table').find('tr:last').after($version_row); } } } $the_link.html('Hide'); }); // Remove versions } else { var $next = $the_link.parent().parent().next();
<input type="submit" value="Go" class="generic_button" /> <a href="javascript:;">clear</a> <?php if (count($current_book_files)) { ?> <span class="prev"></span> <span class="pagination"></span> <b class="total"><?php echo count($current_book_files); ?> </b> media <span class="next"></span> <?php } ?> </form> <?php if (!empty($book)) { $url_base = confirm_slash(base_url()) . confirm_slash($book->slug); ?> <div style="float:right;"> Import pages: <select id="selectImportPages" class="generic_text_input"> <option value=""> </option> <optgroup label="Affiliated archives"> <option value="<?php echo $url_base; ?> import/critical_commons">Critical Commons</option> <option value="<?php echo $url_base; ?> import/cuban_theater_digital_archive">Cuban Theater Digital Archive</option> <option value="<?php
?> " /> <input type="hidden" name="scalar:child_type" value="http://scalar.usc.edu/2012/01/scalar-ns#Book" /> <input type="hidden" name="scalar:child_rel" value="page" /> <input type="hidden" name="sioc:content" value="" /> <input type="hidden" name="rdf:type" value="http://scalar.usc.edu/2012/01/scalar-ns#Media" /> <table class="form_fields"> <tr><td class="field">Title</td><td><input type="text" name="dcterms:title" class="input_text" /></td></tr> <tr><td class="field">Description</td><td><input type="text" name="dcterms:description" class="input_text" /></td></tr> <tr><td class="field">Upload to</td><td> <input type="radio" name="slug_prepend" value="" /> <?php echo confirm_slash($book->slug); ?> <br /> <input type="radio" name="slug_prepend" value="media" CHECKED /> <?php echo confirm_slash($book->slug); ?> media<br /> </td></tr> <tr><td class="field">Media page URL</td><td><input type="radio" name="name_policy" value="filename" /> Create from filename <input type="radio" name="name_policy" value="title" CHECKED /> Create from title</td></tr> <tr> <td class="field">Replace existing</td> <td><select name="replace" style="width:100%;"><option rel="" value="">-- choose an existing local media file to replace with this upload</option><?php foreach ($book_media as $book_media_row) { if (!isset($book_media_row->versions) || empty($book_media_row->versions)) { continue; } if (!$this->versions->url_is_local($book_media_row->versions[0]->url)) { continue; } echo '<option ';
/** * Return the URI of a version (e.g., http://.../.../...) based on a version ID */ public function get_uri($version_id = 0) { $this->db->select('*'); $this->db->where($this->books_table . '.book_id', $this->get_book($version_id)); $query = $this->db->get($this->books_table); $result = $query->result(); $book_slug = $result[0]->slug; return confirm_slash(base_url() . confirm_slash($book_slug) . $this->slug($version_id)); }
/** * Determine if paywall page should be presented rather than the protected page content */ protected function can_bypass_paywall() { try { if ($this->login_is_book_admin('Reader')) { throw new Exception('Reader logged in'); } $book_slug = $this->data['book']->slug; if (empty($book_slug)) { throw new Exception('Invalid book slug'); } $tinypass_config_path = confirm_slash(FCPATH) . $book_slug . '/tinypass.php'; if (!file_exists($tinypass_config_path)) { throw new Exception('Could not find Tinypass config'); } require_once $tinypass_config_path; if (empty($tinypass) || !is_array($tinypass)) { throw new Exception('No $tinypass in tinypass.php'); } $this->load->library('Tinypass_Helper', $tinypass); return false; } catch (Exception $e) { return $e->getMessage(); } }
<div class="saved">Your account has been created.<br />Sign in for the first time below.</div> <?php } if (@$_REQUEST['msg'] == 1) { ?> <div class="error">Please sign in to view the requested page</div> <?php } if (@$_REQUEST['msg'] == 2) { ?> <div class="saved">Your password has been reset. Please login below to continue.</div> <?php } ?> <form action="<?php echo confirm_slash(base_url()); ?> system/login" method="post" class="panel"> <input type="hidden" name="action" value="do_login" /> <input type="hidden" name="redirect_url" value="<?php echo @htmlspecialchars($_REQUEST['redirect_url']); ?> " /> <input type="hidden" name="msg" value="<?php echo (int) @$_REQUEST['msg']; ?> " /> <table class="form_fields"> <tr> <td class="login_header" colspan="2"> <img src="application/views/modules/login/scalar_logo.png" alt="scalar_logo" width="75" height="68" />
private function upload() { $action = isset($_POST['action']) ? strtolower($_POST['action']) : null; $chmod_mode = $this->config->item('chmod_mode'); if (empty($chmod_mode)) { $chmod_mode = 0777; } if (!$this->login_is_book_admin('Commentator')) { if ($action == 'add') { echo json_encode(array('error' => 'Not logged in or not an author')); } else { $this->kickout(); } exit; } $this->data['view'] = __FUNCTION__; if ($action == 'add' || $action == 'replace') { $return = array('error' => ''); try { $slug = confirm_slash($this->data['book']->slug); $url = $this->file_upload->uploadMedia($slug, $chmod_mode, $this->versions); $path = confirm_slash(FCPATH) . confirm_slash($this->data['book']->slug) . $url; $thumbUrl = $this->file_upload->createMediaThumb($slug, $url, $chmod_mode); } catch (Exception $e) { $return['error'] = $e->getMessage(); echo json_encode($return); exit; } $this->load->library('Image_Metadata', 'image_metadata'); $return = array(); $return[$url] = $this->image_metadata->get($path, Image_Metadata::FORMAT_NS); if (false !== $thumbUrl) { $return[$url]['scalar:thumbnail'] = confirm_slash(base_url()) . $slug . $thumbUrl; } echo json_encode($return); exit; } // List of media pages // TODO: replace versioning with the set_recent_version_id method used elsewhere $this->data['book_media'] = $this->pages->get_all($this->data['book']->book_id, 'media', null, false); $to_remove = array(); for ($j = 0; $j < count($this->data['book_media']); $j++) { $this->data['book_media'][$j]->versions = $this->versions->get_all($this->data['book_media'][$j]->content_id, null, 1); //if (!$this->versions->url_is_public($this->data['book_media'][$j]->versions[0]->url)) $to_remove[] = $j; } }