public function sendWordsAction($data = array()) { $req = new Request(); $doc = new Document($req->Get('docId')); $doc->saveWords($req->Get('words')); $data = array('docId' => $doc->getId(), 'docWords' => $doc->getWords()); return json_encode($data); }
public static function GenerateFromCustom($type) { $DB = GetDB(); $schema = GetDBSchema(); $xtable = $schema->el('//table[naming/type="' . $type . '"]'); $primary_key = $xtable->columns->primaryKey->val(); $custom_schema_table = $xtable->custom->val() . '_schema'; $html = ''; $result = $DB->Query('SELECT * FROM # ORDER BY `field_id`', array($custom_schema_table)); while ($field = $DB->NextRow($result)) { switch ($field['type']) { case self::TEXT: $html .= '<div class="field">' . ' <label>' . $field['label'] . ':</label>' . ' <span class="field-container">' . ' <input type="text" size="60" name="' . $field['name'] . '" value="' . Request::Get($field['name']) . '" />' . ' </span>' . '</div>'; break; case self::TEXTAREA: $html .= '<div class="field">' . ' <label>' . $field['label'] . ':</label>' . ' <span class="field-container">' . ' <textarea name="' . $field['name'] . '" rows="5" cols="80">' . Request::Get($field['name']) . '</textarea>' . ' </span>' . '</div>'; break; case self::SELECT: $html .= '<div class="field">' . ' <label>' . $field['label'] . ':</label>' . ' <span class="field-container">' . ' <select name="' . $field['name'] . '">' . self::OptionsSimple($field['options'], Request::Get($field['name'])) . ' </select>' . ' </span>' . '</div>'; break; case self::CHECKBOX: $html .= '<div class="field">' . ' <label></label>' . ' <span class="field-container">' . ' <div class="checkbox">' . ' <input type="hidden" name="' . $field['name'] . '" value="' . Request::Get($field['name']) . '" />' . ' ' . $field['label'] . ' </div>' . ' </span>' . '</div>'; break; } } $DB->Free($result); if (empty($html)) { $html = '<div class="message-warning text-center">No Custom Fields Have Been Defined</div>'; } return $html; }
public function start() { $this->region_id = intval(Request::Cookie('region_id', 0)); $this->group_id = intval(Request::GetPart(1, 0)); $this->groups_array = GroupModel::GetList(); $this->groups_array[0] = 'Все направления'; $this->regions_array = RegionModel::GetList(); $this->regions_array[0] = 'Вся Россия'; if (!isset($this->groups_array[$this->group_id])) { $this->group_id = 0; } if (!isset($this->regions_array[$this->region_id])) { $this->region_id = 0; } $this->page_link_prefix = $this->group_id . '/'; $this->page = intval(Request::GetPart(2, 1)); if ($this->page == 0) { $this->page = 1; } $this->search = trim(Request::Get('q', '')); if ($this->search != '') { $this->SearchCommand(); } Site::$search_link = Site::Link('list/' . $this->group_id . '/'); }
public function __construct($source) { $this->source = $source; // Do not put into thumbnail generation queue if video file is not being hotlinked if (!Request::Get('flag_hotlink')) { $_REQUEST['flag_thumb'] = 0; } }
public function __construct($xtable) { $this->xtable = $xtable; $this->calculated_amount = null; parse_str(Request::Get('search'), $this->search_form); if (!isset($this->search_form['selected'])) { $this->type = self::$TYPE_MATCHING; } else { $this->type = self::$TYPE_SELECTED; } }
function DatabaseTest() { global $DB; try { $DB = new Database_MySQL(Request::Get('db_username'), Request::Get('db_password'), Request::Get('db_database'), Request::Get('db_hostname')); $version = $DB->Version(); if (!($version['major'] > 4 || $version['major'] == 4 && $version['minor'] > 0)) { throw new BaseException('This software requires MySQL Server version 4.1.0 or newer', 'Your MySQL Server is version ' . $version['full']); } } catch (Exception $e) { include_once 'install-main.php'; return false; } return true; }
public function getLocationsAction() { $consumer_key = "FsywtAd1oz2eXBmyB287aQ"; $consumer_secret = "5TcavjzraS012EzEvVNwbqRTZkU"; $token = "S2zHmcgmot067mpaELvpFl99eycuTjn-"; $token_secret = "ZB1IkWAwa3X7_yq1i0U9dBjJkX8"; $unsigned_url = "http://api.yelp.com/v2/search?1=1"; $token = new OAuthToken($token, $token_secret); $consumer = new OAuthConsumer($consumer_key, $consumer_secret); $request = new Request(); $term = $request->Get("term"); $radius = $request->Get("radius"); $ll = $request->Get("ll"); $unsigned_url .= "&ll=" . ($ll == "" ? "39,-84" : $ll); $unsigned_url .= "&radius_filter=" . ($radius == "" ? 1000 : $radius * 1000); $unsigned_url .= $term == "" ? "" : "&term=" . $term; // Yelp uses HMAC SHA1 encoding $signature_method = new OAuthSignatureMethod_HMAC_SHA1(); // Build OAuth Request using the OAuth PHP library. Uses the consumer and token object created above. $oauthrequest = OAuthRequest::from_consumer_and_token($consumer, $token, 'GET', $unsigned_url); // Sign the request $oauthrequest->sign_request($signature_method, $consumer, $token); // Get the signed URL $signed_url = $oauthrequest->to_url(); $ch = curl_init($signed_url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HEADER, 0); $data = curl_exec($ch); // Yelp response curl_close($ch); // Handle Yelp response data //$response = json_decode($data); $response = $data; // Print it for debugging return $response; }
<div class="field"> <label>Frequency:</label> <span class="field-container"><input type="text" size="5" name="frequency" value="<?php echo Request::Get('frequency'); ?> " /></span> </div> </div> </div> <div id="dialog-buttons"> <img src="images/activity-16x16.gif" height="16" width="16" border="0" title="Working..." /> <input type="submit" id="button-save" value="<?php echo isset($editing) ? 'Save Changes' : 'Add Search Term'; ?> " /> <input type="button" id="dialog-button-cancel" value="Cancel" style="margin-left: 10px;" /> </div> <input type="hidden" name="r" value="<?php echo isset($editing) ? 'tbxGenericEdit' : 'tbxGenericAdd'; ?> (search-term)" /> <input type="hidden" name="term_id" value="<?php echo Request::Get('term_id'); ?> " /> </form>
/** * Returns a form parameter minus currency symbols * * @param string $fieldname * @return string */ public static function GetCurrency($fieldname) { return str_replace(array(',', '$'), '', Request::Get($fieldname)); }
private function deleteContent($plugmodlist) { $name = Request::Get('name'); foreach ($plugmodlist as $key => $val) { if (array_key_exists($name, $val)) { if ($val[$name]['type'] == 'plugin') { $class = PluginEngine::getPlugin(get_class($val[$name]['object'])); $displayname = $class->getPluginName(); } elseif ($val[$name]['type'] == 'modul') { if ($this->sem_class) { $class = $this->sem_class->getModule($this->sem_class->getSlotModule($val[$name]['modulkey'])); $displayname = $val[$name]['object']['name']; } } } } if (Request::submitted('check')) { if (method_exists($class, 'deleteContent')) { $class->deleteContent(); } else { PageLayout::postMessage(MessageBox::info(_("Das Plugin/Modul enthält keine Funktion zum Löschen der Inhalte."))); } } else { PageLayout::postMessage(MessageBox::info(sprintf(_("Sie beabsichtigen die Inhalte von %s zu löschen."), $displayname) . "<br>" . _("Wollen Sie die Inhalte wirklich löschen?") . "<br>" . LinkButton::createAccept(_('Ja'), URLHelper::getURL("?deleteContent=true&check=true&name=" . $name)) . LinkButton::createCancel(_('Nein')))); } }
function tbxBannerDisplay() { $DB = GetDB(); $banner = $DB->Row('SELECT * FROM `tbx_banner` WHERE `banner_id`=?', array(Request::Get('id'))); echo "<html><body style=\"margin: 0; padding: 0;\">" . $banner['banner_html'] . "</body></html>"; }
public static function Import($settings) { $DB = GetDB(); ProgressBarShow('pb-import'); $file = TEMP_DIR . '/' . File::Sanitize($settings['import_file']); $fp = fopen($file, 'r'); $filesize = filesize($file); $line = $read = $imported = 0; $expected = count($settings['fields']); while (!feof($fp)) { $line++; $string = fgets($fp); $read += strlen($string); $data = explode($settings['delimiter'], trim($string)); ProgressBarUpdate('pb-import', $read / $filesize * 100); // Line does not have the expected number of fields if (count($data) != $expected) { continue; } $video = array(); $defaults = array('category_id' => $settings['category_id'], 'sponsor_id' => $settings['sponsor_id'], 'username' => $settings['username'], 'duration' => Format::DurationToSeconds($settings['duration']), 'status' => $settings['status'], 'next_status' => $settings['status'], 'allow_comments' => $settings['allow_comments'], 'allow_ratings' => $settings['allow_ratings'], 'allow_embedding' => $settings['allow_embedding'], 'is_private' => $settings['is_private'], 'date_added' => Database_MySQL::Now(), 'is_featured' => 0, 'is_user_submitted' => 0, 'conversion_failed' => 0, 'tags' => null, 'title' => null, 'description' => null); foreach ($settings['fields'] as $index => $field) { if (!empty($field)) { $video[$field] = trim($data[$index]); } } // Setup clips $clips = array(); $thumbs = array(); $clip_type = 'URL'; if (isset($video['embed_code'])) { // Cannot convert or thumbnail from embed code $settings['flag_convert'] = $settings['flag_thumb'] = false; $clips[] = $video['embed_code']; $clip_type = 'Embed'; } else { if (isset($video['gallery_url'])) { $http = new HTTP(); if (!$http->Get($video['gallery_url'])) { // Broken gallery URL, continue continue; } list($thumbs, $clips) = Video_Source_Gallery::ExtractUrls($http->url, $http->body); } else { if (!isset($video['video_url']) && isset($video['base_video_url'])) { if (!preg_match('~/$~', $video['base_video_url'])) { $video['base_video_url'] .= '/'; } foreach (explode(',', $video['video_filename']) as $filename) { $clips[] = $video['base_video_url'] . $filename; } } else { $clips[] = $video['video_url']; } } } // Check for duplicate clips $duplicate = false; foreach ($clips as $clip) { if (!Request::Get('flag_skip_imported_check') && $DB->QueryCount('SELECT COUNT(*) FROM `tbx_imported` WHERE `video_url`=?', array($clip)) > 0) { $duplicate = true; } $DB->Update('REPLACE INTO `tbx_imported` VALUES (?)', array($clip)); } // Dupe found if ($duplicate) { continue; } // Setup thumbs if (!isset($video['gallery_url']) && !isset($video['thumbnail_url']) && isset($video['base_thumbnail_url'])) { if (!preg_match('~/$~', $video['base_thumbnail_url'])) { $video['base_thumbnail_url'] .= '/'; } foreach (explode(',', String::FormatCommaSeparated($video['thumbnail_filename'])) as $filename) { $thumbs[] = $video['base_thumbnail_url'] . $filename; } } else { if (!isset($video['gallery_url']) && isset($video['thumbnail_url'])) { $thumbs[] = $video['thumbnail_url']; } } // Setup duration if (isset($video['duration_seconds'])) { $video['duration'] = $video['duration_seconds']; } else { if (isset($video['duration_formatted'])) { $video['duration'] = Format::DurationToSeconds($video['duration_formatted']); } } // Use description for title if (empty($video['title'])) { $video['title'] = isset($video['description']) ? $video['description'] : ''; } // Use title for description if (empty($video['description'])) { $video['description'] = isset($video['title']) ? $video['title'] : ''; } // Use title for tags if (empty($video['tags'])) { $video['tags'] = isset($video['title']) ? $video['title'] : ''; } // Setup category if (isset($video['category']) && ($category_id = $DB->QuerySingleColumn('SELECT `category_id` FROM `tbx_category` WHERE `name` LIKE ?', array($video['category']))) !== false) { $video['category_id'] = $category_id; } else { if (($category_id = GetBestCategory($video['title'] . ' ' . $video['description'])) !== null) { $video['category_id'] = $category_id; } } // Merge in the defaults $video = array_merge($defaults, $video); // Format tags and convert to UTF-8 $video['tags'] = Tags::Format($video['tags']); $video = String::ToUTF8($video); if (Request::Get('flag_convert')) { $video['status'] = STATUS_QUEUED; } // Add to database $video['video_id'] = DatabaseAdd('tbx_video', $video); DatabaseAdd('tbx_video_custom', $video); DatabaseAdd('tbx_video_stat', $video); if ($video['is_private']) { $video['private_id'] = sha1(uniqid(mt_rand(), true)); DatabaseAdd('tbx_video_private', $video); } if ($video['status'] == STATUS_QUEUED) { $video['queued'] = time(); DatabaseAdd('tbx_conversion_queue', $video); } if (Request::Get('flag_thumb')) { $video['queued'] = time(); DatabaseAdd('tbx_thumb_queue', $video); } if ($video['status'] == STATUS_ACTIVE && !$video['is_private']) { Tags::AddToFrequency($video['tags']); } // Add clips foreach ($clips as $clip) { DatabaseAdd('tbx_video_clip', array('video_id' => $video['video_id'], 'type' => $clip_type, 'clip' => $clip)); } $dir = new Video_Dir(Video_Dir::DirNameFromId($video['video_id'])); // Process thumbs $thumb_ids = array(); foreach ($thumbs as $thumb) { $http = new HTTP(); if ($http->Get($thumb, $thumb)) { if (Video_Thumbnail::CanResize()) { $thumb_temp = $dir->AddTempFromVar($http->body, 'jpg'); $thumb_file = Video_Thumbnail::Resize($thumb_temp, Config::Get('thumb_size'), Config::Get('thumb_quality'), $dir->GetThumbsDir()); } else { $thumb_file = $dir->AddThumbFromVar($http->body); } if (!empty($thumb_file)) { $thumb_ids[] = DatabaseAdd('tbx_video_thumbnail', array('video_id' => $video['video_id'], 'thumbnail' => str_replace(Config::Get('document_root'), '', $thumb_file))); } } } // Determine number of thumbnails and select random display thumbnail $num_thumbnails = count($thumb_ids); $display_thumbnail = null; if ($num_thumbnails > 0) { // Select display thumbnail randomly from the first 40% $display_thumbnail = $thumb_ids[rand(0, floor(0.4 * $num_thumbnails))]; } DatabaseUpdate('tbx_video', array('video_id' => $video['video_id'], 'num_thumbnails' => $num_thumbnails, 'display_thumbnail' => $display_thumbnail)); $imported++; } fclose($fp); UpdateCategoryStats(); UpdateSponsorStats($settings['sponsor_id']); $t = new Template(); $t->ClearCache('categories.tpl'); ProgressBarHide('pb-import', NumberFormatInteger($imported) . ' videos have been imported!'); // Start up the thumbnail and converson queues if needed if (!Config::Get('flag_using_cron')) { if (Request::Get('flag_convert')) { ConversionQueue::Start(); } if (Request::Get('flag_thumb')) { ThumbQueue::Start(); } } File::Delete($file); }
<?php $reflect = new ReflectionClass('Privileges'); $privileges = $reflect->getConstants(); $counter = 0; $total = count($privileges); foreach ($privileges as $privilege => $bitmask) { $counter++; ?> <td width="33%"> <div class="checkbox"> <input type="hidden" name="PRIVILEGE_<?php echo $privilege; ?> " value="<?php echo $bitmask & Request::Get('privileges') ? 1 : 0; ?> " /> Manage <?php echo ucwords(strtolower(str_replace('_', ' ', $privilege))); ?> </div> </td> <?php if ($counter % 3 == 0 && $counter != $total) { ?> </tr> <tr> <?php } }
<div id="dialog-buttons"> <img src="images/activity-16x16.gif" height="16" width="16" border="0" title="Working..." /> <input type="submit" id="button-save" value="<?php echo isset($editing) ? 'Save Changes' : 'Add Custom Video Field'; ?> " /> <input type="button" id="dialog-button-cancel" value="Cancel" style="margin-left: 10px;" /> </div> <input type="hidden" name="r" value="<?php echo isset($editing) ? 'tbxGenericEdit' : 'tbxGenericAdd'; ?> (video-custom-field)" /> <input type="hidden" name="field_id" value="<?php echo Request::Get('field_id'); ?> " /> </form> <div id="validator-master" style="margin: 3px 0; display: none;"> <select name="validator[type][]"> <?php $reflect = new ReflectionClass('Validator_Type'); echo Form_Field::Options(array_flip($reflect->getConstants())); ?> </select> <input type="text" name="validator[message][]" size="40" defaultvalue="Error message" class="defaultvalue" value="Error message" /> <input type="text" name="validator[extras][]" size="10" defaultvalue="Extras" class="defaultvalue" value="Extras" /> <img src="images/add-16x16.png" class="clickable vertical-middle" style="padding-left: 6px;" title="Add" /> <img src="images/remove-16x16.png" class="clickable vertical-middle" style="padding-left: 6px;" title="Remove" />
<div class="checkbox"> <input type="hidden" name="is_default" value="<?php echo Request::Get('is_default'); ?> " /> Use as default </div> </span> </div> </div> </div> <div id="dialog-buttons"> <img src="images/activity-16x16.gif" height="16" width="16" border="0" title="Working..." /> <input type="submit" id="button-save" value="<?php echo isset($editing) ? 'Save Changes' : 'Add User Level'; ?> " /> <input type="button" id="dialog-button-cancel" value="Cancel" style="margin-left: 10px;" /> </div> <input type="hidden" name="r" value="<?php echo isset($editing) ? 'tbxGenericEdit' : 'tbxGenericAdd'; ?> (user-level)" /> <input type="hidden" name="user_level_id" value="<?php echo Request::Get('user_level_id'); ?> " /> </form>
$emsg = ""; if (Request::Post('login_key') == "1") { $username = Request::Post('username'); $password = Request::Post('password'); if ($username == "" || $password == "") { $emsg = "Please enter both username and password."; } else { $db = new Db($db_config); $sql = <<<SQL SELECT * FROM `users` WHERE `username` = '%s' AND `password` = '%s' AND `active` = 1 SQL; $sql = sprintf($sql, $db->escString($username), $db->escString(md5($password . SALT))); if ($db->numRows($sql) > 0) { $user = $db->row($sql); $db->execute(sprintf("UPDATE `users` SET `logged_at` = '%s' WHERE `id` = %d", date('Y-m-d h:i:s'), (int) $db->escString($user['id']))); Session::Set('username', $user['username']); Session::Set('id', $user['id']); Response::Redirect(ADMIN_ROOT . 'index.php'); } else { $emsg = "Login Failed"; } } } if (Request::Get('logout') == 'true') { Session::Destroy('username'); Session::Destroy('id'); Response::Redirect(ADMIN_ROOT . 'login.php'); } //------------------------------------------------------- echo Util::Render('master.phtml', array('page_title' => 'Login', 'content' => Util::Render('login.phtml', array('emsg' => $emsg))));
<?php /** * Memcached monitor service * returns JSON to be consumed by the client javascript * * @author Jason Hinkle http://www.verysimple.com * @version 1.0 */ require_once "_config.php"; require_once "verysimple/HTTP/Request.php"; require_once "JSON.php"; $id = Request::Get("id", 0); $info = $servers[$id]; $memcache = new Memcache(); $memcache->addServer($info->host, $info->port); $stats = @$memcache->getExtendedStats(); $json = new Services_JSON(); header("Content-Type: application/json"); print $json->encode($stats[$info->getKey()]);
function tbxGenericShowEdit($type) { Privileges::Check(Privileges::FromType($type)); $DB = GetDB(); $schema = GetDBSchema(); $xtable = $schema->el('//table[naming/type="' . $type . '"]'); $xnaming = $xtable->naming; $table = $xtable->name->val(); $primary_key = $xtable->columns->primaryKey->val(); $editing = true; $output = array(); $_REQUEST = $DB->Row('SELECT * FROM # WHERE #=?', array($table, $primary_key, Request::Get('id'))); // Get user defined fields if (!empty($xtable->custom)) { $custom_data = $DB->Row('SELECT * FROM # WHERE #=?', array($xtable->custom->val(), $primary_key, Request::Get($primary_key))); if (is_array($custom_data)) { $_REQUEST = array_merge($custom_data, $_REQUEST); } } $original = $_REQUEST; $_REQUEST = String::HtmlSpecialChars($_REQUEST); ob_start(); include "cp-{$type}-add-edit.php"; IncludeJavascript('js/cp-global-edit.js'); IncludeJavascript("js/cp-{$type}-edit.js"); $output['html'] = ob_get_clean(); JSON::Success($output); }
<?php } ?> </ul> </div> <?php } ?> <div class="field"> <label>Source:</label> <span class="field-container"> <select name="source"> <?php $sources = array(Video_Import::SOURCE_CLIPBOARD, Video_Import::SOURCE_UPLOAD, Video_Import::SOURCE_URL); echo Form_Field::OptionsSimple($sources, Request::Get('source')); ?> </select> </span> </div> <div class="field"> <label>Delimiter:</label> <span class="field-container"><input type="text" name="delimiter" style="width: 18px;" value="|" /></span> </div> <div class="field source source-Upload"> <label>File:</label> <span class="field-container"> <input type="file" name="<?php
<div class="checkbox"> <input type="hidden" name="is_private" value="<?php echo Request::Get('is_private'); ?> " /> Make private </div> </span> </div> <div class="field"> <label></label> <span class="field-container"> <div class="checkbox"> <input type="hidden" name="flag_skip_imported_check" value="<?php echo Request::Get('flag_skip_imported_check'); ?> " /> Do not check if these videos have been imported before (may result in duplicates!) </div> </span> </div> </div> <?php if ($si->can_convert || $si->can_thumbnail) { ?> <div class="fieldset"> <div class="legend">Import Settings</div>
public function RegisterFromXml($xtable, $section = 'admin', $location = 'create') { $reflect = new ReflectionClass('Validator_Type'); foreach ($xtable->xpath('./columns/column') as $xcolumn) { $xsection = $xcolumn->el('./' . $section); if ($section != 'admin' && !empty($xsection) && !$xsection->el('./' . $location)->val()) { continue; } $xvalidators = $xcolumn->xpath('./' . $section . '/validator'); if (empty($xvalidators)) { continue; } foreach ($xvalidators as $xvalidator) { $type = $reflect->getConstant($xvalidator->type->val()); $value = Request::Get($xcolumn->name->val()); switch ($xvalidator->condition->val()) { case self::COND_NOT_EMPTY: if (String::IsEmpty($value)) { break; } default: $this->Register($value, $type, $xvalidator->message->val(), $xvalidator->extras->val()); break; } } } }
<div class="field"> <label>Banner HTML:</label> <span class="field-container"> <textarea name="banner_html" rows="8" style="width: 600px;"><?php echo Request::Get('banner_html'); ?> </textarea> </span> </div> </div> </div> <div id="dialog-buttons"> <img src="images/activity-16x16.gif" height="16" width="16" border="0" title="Working..." /> <input type="submit" id="button-save" value="<?php echo isset($editing) ? 'Save Changes' : 'Add Banner'; ?> " /> <input type="button" id="dialog-button-cancel" value="Cancel" style="margin-left: 10px;" /> </div> <input type="hidden" name="r" value="<?php echo isset($editing) ? 'tbxGenericEdit' : 'tbxGenericAdd'; ?> (banner)" /> <input type="hidden" name="banner_id" value="<?php echo Request::Get('banner_id'); ?> " /> </form>
<div class="field"> <label>Reason:</label> <span class="field-container"><input type="text" size="60" name="reason" value="<?php echo Request::Get('reason'); ?> " /></span> </div> </div> </div> <div id="dialog-buttons"> <img src="images/activity-16x16.gif" height="16" width="16" border="0" title="Working..." /> <input type="submit" id="button-save" value="<?php echo isset($editing) ? 'Save Changes' : 'Add Blacklist Item'; ?> " /> <input type="button" id="dialog-button-cancel" value="Cancel" style="margin-left: 10px;" /> </div> <input type="hidden" name="r" value="<?php echo isset($editing) ? 'tbxGenericEdit' : 'tbxGenericAdd'; ?> (blacklist-item)" /> <input type="hidden" name="blacklist_id" value="<?php echo Request::Get('blacklist_id'); ?> " /> </form>
define('DS', DIRECTORY_SEPARATOR); define('ADMIN_DIR', dirname(__FILE__) . DS . '..' . DS); define('BASE_DIR', dirname(__FILE__) . DS . '..' . DS . '..' . DS); define('ADMIN_ROOT', '../'); define('SITE_ROOT', '../../'); require_once BASE_DIR . 'Libs' . DS . 'autoload.php'; require_once BASE_DIR . 'configs' . DS . 'incs.php'; require_once BASE_DIR . 'helpers' . DS . 'incs.php'; require_once ADMIN_DIR . 'incs' . DS . 'incs.php'; //------------------------------------------------------- Util::$template_path = ADMIN_DIR . 'templates' . DS; //------------------------------------------------------- $db = new Db($db_config); $sql = "SELECT * FROM `users` ORDER BY `id` DESC"; $done = Request::Get('done'); $smsg = ""; switch (strtolower($done)) { case 'add': $smsg = "User added successfully"; break; case 'edit': $smsg = "User edited successfully"; break; case 'delete': $smsg = "User deleted successfully"; break; case 'edit_password': $smsg = "User password edited successfully"; } //-------------------------------------------------------
} ?> </div> </div> <div id="dialog-buttons"> <img src="images/activity-16x16.gif" height="16" width="16" border="0" title="Working..." /> <input type="submit" value="Clear Reasons" r="tbxVideoReasonFeaturedClear" /> <input type="button" value="Feature Video" r="tbxVideoFeature" style="margin-left: 10px;" /> <input type="button" value="Un-Feature Video" r="tbxVideoUnfeature" style="margin-left: 10px;" /> <input type="button" id="dialog-button-cancel" value="Close" style="margin-left: 10px;" /> </div> <input type="hidden" name="video_id" value="<?php echo Request::Get('id'); ?> " /> <input type="hidden" name="r" value="" /> </form> <script language="JavaScript"> $('#dialog-content input[type="button"]') .click(function() { var video_id = $('#dialog-content input[name="video_id"]').val(); switch($(this).val()) { case 'Feature Video':
<?php define('DS', DIRECTORY_SEPARATOR); define('ADMIN_DIR', dirname(__FILE__) . DS . '..' . DS); define('BASE_DIR', dirname(__FILE__) . DS . '..' . DS . '..' . DS); define('ADMIN_ROOT', '../'); define('SITE_ROOT', '../../'); require_once BASE_DIR . 'Libs' . DS . 'autoload.php'; require_once BASE_DIR . 'configs' . DS . 'incs.php'; require_once BASE_DIR . 'helpers' . DS . 'incs.php'; require_once ADMIN_DIR . 'incs' . DS . 'incs.php'; //------------------------------------------------------- Util::$template_path = ADMIN_DIR . 'templates' . DS; //------------------------------------------------------- $id = Request::Get('id'); if (is_null($id)) { Response::Redirect('index.php'); } $emsg = ""; $errors = array(); $db = new Db($db_config); $sql_user = "******"; $sql_user = sprintf($sql_user, (int) $db->escString($id)); if (Request::Post('delete_user_key') == "1") { if (Session::Get('id') != $id) { $sql = "DELETE FROM `users` WHERE `id` = %d"; $sql = sprintf($sql, (int) $db->escString($id)); if ($db->execute($sql)) { Response::Redirect("index.php?done=delete"); } else { $emsg = "Could not delete user. Something went wrong. Please try again.";
<div id="dialog-buttons"> <img src="images/activity-16x16.gif" height="16" width="16" border="0" title="Working..." /> <input type="submit" id="button-save" value="<?php echo isset($editing) ? 'Save Changes' : 'Add Category'; ?> " /> <input type="button" id="dialog-button-cancel" value="Cancel" style="margin-left: 10px;" /> </div> <input type="hidden" name="r" value="<?php echo isset($editing) ? 'tbxGenericEdit' : 'tbxGenericAdd'; ?> (category)" /> <input type="hidden" name="category_id" value="<?php echo Request::Get('category_id'); ?> " /> </form> <script language="JavaScript" type="text/javascript"> $(function() { $('input[name="name"]') .change(function() { var suggested = $(this).val().replace(/[&]/g, 'and').replace(/[^a-z0-9]/gi, '-').replace(/-+/gi, '-').toLowerCase(); $('input[name="url_name"]').attr('acomplete', '#' + suggested).unautocomplete().autocomplete(); }); }); </script>
<div class="fieldset"> <div class="legend">Custom Fields</div> <?php echo Form_Field::GenerateFromCustom('sponsor'); ?> </div> </div> </div> <div id="dialog-buttons"> <img src="images/activity-16x16.gif" height="16" width="16" border="0" title="Working..." /> <input type="submit" id="button-save" value="<?php echo isset($editing) ? 'Save Changes' : 'Add Sponsor'; ?> " /> <input type="button" id="dialog-button-cancel" value="Cancel" style="margin-left: 10px;" /> </div> <input type="hidden" name="r" value="<?php echo isset($editing) ? 'tbxGenericEdit' : 'tbxGenericAdd'; ?> (sponsor)" /> <input type="hidden" name="sponsor_id" value="<?php echo Request::Get('sponsor_id'); ?> " /> </form>
</div> </div> <div id="dialog-buttons"> <img src="images/activity-16x16.gif" height="16" width="16" border="0" title="Working..." /> <?php if (!empty($categories)) { ?> <input type="submit" id="button-save" value="<?php echo isset($editing) ? 'Save Changes' : 'Add Video'; ?> " /> <?php } ?> <input type="button" id="dialog-button-cancel" value="Cancel" style="margin-left: 10px;" /> </div> <input type="hidden" name="r" value="<?php echo isset($editing) ? 'tbxVideoEdit' : 'tbxVideoAdd'; ?> (video)" /> <input type="hidden" name="video_id" value="<?php echo Request::Get('video_id'); ?> " /> <input type="hidden" name="detailed" value="0" /> </form> <?php IncludeJavascript(BASE_DIR . '/admin/js/cp-video-add.js');
public static function Verify() { // Retrieve $DB = GetDB(); $captcha = $DB->Row('SELECT * FROM # WHERE `session`=?', array(self::TABLE, $_COOKIE[self::COOKIE])); // Validate $v = Validator::Create(); $v->Register(!empty($captcha) && strtoupper($captcha['code']) == strtoupper(Request::Get('captcha')), Validator_Type::IS_TRUE, _T('Validation:Invalid Captcha')); // Remove $DB->Update('DELETE FROM # WHERE `session`=?', array(self::TABLE, $_COOKIE[self::COOKIE])); setcookie(self::COOKIE, null, time() - self::EXPIRES, Config::Get('cookie_path'), Config::Get('cookie_domain')); }