/** * Outputs frontpage HTML * * @return Nothing */ function uploadConfirmPerl() { global $database, $my, $acl, $mosConfig_absolute_path, $mosConfig_mailfrom, $mosConfig_fromname, $mosConfig_live_site, $Itemid, $mosConfig_sitename; $c = hwd_vs_Config::get_instance(); $db = & JFactory::getDBO(); $my = & JFactory::getUser(); $acl= & JFactory::getACL(); // get server configuration data require_once(JPATH_SITE.DS.'administrator'.DS.'components'.DS.'com_hwdvideoshare'.DS.'serverconfig.hwdvideoshare.php'); $s = hwd_vs_SConfig::get_instance(); //****************************************************************************************************** // ATTENTION: THIS FILE HEADER MUST REMAIN INTACT. DO NOT DELETE OR MODIFY THIS FILE HEADER. // // Name: ubr_finished.php // Revision: 1.3 // Date: 2/18/2008 5:36:57 PM // Link: http://uber-uploader.sourceforge.net // Initial Developer: Peter Schmandra http://www.webdice.org // Description: Show successful file uploads. // // Licence: // The contents of this file are subject to the Mozilla Public // License Version 1.1 (the "License"); you may not use this file // except in compliance with the License. You may obtain a copy of // the License at http://www.mozilla.org/MPL/ // // Software distributed under the License is distributed on an "AS // IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or // implied. See the License for the specific language governing // rights and limitations under the License. // //*************************************************************************************************************** //*************************************************************************************************************** // The following possible query string formats are assumed // // 1. ?upload_id=upload_id // 2. ?about=1 //**************************************************************************************************************** $THIS_VERSION = "1.3"; // Version of this file $UPLOAD_ID = ''; // Initialize upload id require_once(JPATH_SITE.DS.'components'.DS.'com_hwdvideoshare'.DS.'assets'.DS.'uploads'.DS.'perl'.DS.'ubr_ini.php'); require_once(JPATH_SITE.DS.'components'.DS.'com_hwdvideoshare'.DS.'assets'.DS.'uploads'.DS.'perl'.DS.'ubr_lib.php'); require_once(JPATH_SITE.DS.'components'.DS.'com_hwdvideoshare'.DS.'assets'.DS.'uploads'.DS.'perl'.DS.'ubr_finished_lib.php'); if($PHP_ERROR_REPORTING){ error_reporting(E_ALL); } header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); header('Last-Modified: '.date('r')); header('Cache-Control: no-store, no-cache, must-revalidate'); header('Cache-Control: post-check=0, pre-check=0', FALSE); header('Pragma: no-cache'); if(preg_match("/^[a-zA-Z0-9]{32}$/", $_GET['upload_id'])){ $UPLOAD_ID = $_GET['upload_id']; } elseif(isset($_GET['about']) && $_GET['about'] == 1){ kak("<u><b>UBER UPLOADER FINISHED PAGE</b></u><br>UBER UPLOADER VERSION = <b>" . $UBER_VERSION . "</b><br>UBR_FINISHED = <b>" . $THIS_VERSION . "<b><br>\n", 1 , __LINE__); } else{ kak("<font color='red'>ERROR</font>: Invalid parameters passed<br>", 1, __LINE__); } //Declare local values $_XML_DATA = array(); // Array of xml data read from the upload_id.redirect file $_CONFIG_DATA = array(); // Array of config data read from the $_XML_DATA array $_POST_DATA = array(); // Array of posted data read from the $_XML_DATA array $_FILE_DATA = array(); // Array of 'FileInfo' objects read from the $_XML_DATA array $_FILE_DATA_TABLE = ''; // String used to store file info results nested between <tr> tags $_FILE_DATA_EMAIL = ''; // String used to store file info results $xml_parser = new XML_Parser; // XML parser $xml_parser->setXMLFile($TEMP_DIR, $_REQUEST['upload_id']); // Set upload_id.redirect file $xml_parser->setXMLFileDelete($DELETE_REDIRECT_FILE); // Delete upload_id.redirect file when finished parsing $xml_parser->parseFeed(); // Parse upload_id.redirect file // Display message if the XML parser encountered an error if($xml_parser->getError()){ kak($xml_parser->getErrorMsg(), 1, __LINE__); } $_XML_DATA = $xml_parser->getXMLData(); // Get xml data from the xml parser $_CONFIG_DATA = getConfigData($_XML_DATA); // Get config data from the xml data $_POST_DATA = getPostData($_XML_DATA); // Get post data from the xml data $_FILE_DATA = getFileData($_XML_DATA); // Get file data from the xml data // Output XML DATA, CONFIG DATA, POST DATA, FILE DATA to screen and exit if DEBUG_ENABLED. if($DEBUG_FINISHED){ debug("<br><u>XML DATA</u>", $_XML_DATA); debug("<u>CONFIG DATA</u>", $_CONFIG_DATA); debug("<u>POST DATA</u>", $_POST_DATA); debug("<u>FILE DATA</u><br>", $_FILE_DATA); exit; } ///////////////////////////////////////////////////////////////////////////////////////////////// // // *** ATTENTION: ENTER YOUR CODE HERE !!! *** // // This is a good place to put your post upload code. Like saving the // uploaded file information to your DB or doing some image // manipulation. etc. Everything you need is in the // $XML DATA, $_CONFIG_DATA, $_POST_DATA and $_FILE_DATA arrays. // ///////////////////////////////////////////////////////////////////////////////////////////////// // NOTE: You can now access all XML values below this comment. eg. // $_XML_DATA['upload_dir']; or $_XML_DATA['link_to_upload'] etc ///////////////////////////////////////////////////////////////////////////////////////////////// // NOTE: You can now access all config values below this comment. eg. // $_CONFIG_DATA['upload_dir']; or $_CONFIG_DATA['link_to_upload'] etc ///////////////////////////////////////////////////////////////////////////////////////////////// // NOTE: You can now access all post values below this comment. eg. // $_POST_DATA['client_id']; or $_POST_DATA['check_box_1_'] etc ///////////////////////////////////////////////////////////////////////////////////////////////// // NOTE: You can now access all file (slot, name, size, type) info below this comment. eg. // $_FILE_DATA[0]->name or $_FILE_DATA[0]->getFileInfo('name') ///////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Create thumnail example (must uncomment line 34) // if( $_FILE_DATA[0]->type == 'image/jpeg'){ $success = createThumbFile($_CONFIG_DATA['upload_dir'], $_FILE_DATA[0]->name, $_CONFIG_DATA['upload_dir'], 120, 100); } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //Create file upload table $_FILE_DATA_TABLE = getFileDataTable($_FILE_DATA, $_CONFIG_DATA); // Create and send email if($_CONFIG_DATA['send_email_on_upload']){ emailUploadResults($_FILE_DATA, $_CONFIG_DATA, $_POST_DATA); } $file_name = $_FILE_DATA[0]->name; $file_ext = substr($file_name, strrpos($file_name, '.') + 1); $file_ext = strtolower($file_ext); $file_video_name = $file_name; $file_video_id = substr($file_name, 0, -(strlen($file_ext)+1)); $title = hwd_vs_tools::generatePostTitle($_POST_DATA['title']); $description = hwd_vs_tools::generatePostDescription($_POST_DATA['description']); $tags = hwd_vs_tools::generatePostTags($_POST_DATA['tags']); $category_id = intval ($_POST_DATA['category_id']); $public_private = $_POST_DATA['public_private']; $allow_comments = intval ($_POST_DATA['allow_comments']); $allow_embedding = intval ($_POST_DATA['allow_embedding']); $allow_ratings = intval ($_POST_DATA['allow_ratings']); $checkform = hwd_vs_tools::checkFormComplete($title, $description, $category_id, $tags, $public_private, $allow_comments, $allow_embedding, $allow_ratings); if (!$checkform) { return; } // initialise database $row = new hwdvids_video($db); if ($file_ext == "swf") { $_POST['video_type'] = "swf"; } else if ($file_ext == "mp4") { $_POST['video_type'] = "mp4"; } else { $_POST['video_type'] = "local"; } $password = $_POST_DATA['hwdvspassword']; if (!empty($password)) { $_POST['password'] = $password; } $_POST['title'] = $title; $_POST['description'] = $description; $_POST['category_id'] = $category_id; $_POST['tags'] = $tags; $_POST['public_private'] = $public_private; $_POST['allow_comments'] = $allow_comments; $_POST['allow_embedding'] = $allow_embedding; $_POST['allow_ratings'] = $allow_ratings; $_POST['date_uploaded'] = date('Y-m-d H:i:s'); $_POST['user_id'] = $my->id; $_POST['published'] = 1; if ($c->requiredins == 1) { $_POST['video_id'] = $file_video_name; // check if we are reprocessing if ($c->reconvertflv == 0) { if ($file_ext == "flv") { $_POST['approved'] = "queuedforthumbnail"; } else if ($file_ext == "swf") { $_POST['approved'] = "queuedforswf"; } else if ($file_ext == "mp4") { $_POST['approved'] = "queuedformp4"; } else { $_POST['approved'] = "queuedforconversion"; } } else { if ($file_ext == "swf") { $_POST['approved'] = "queuedforswf"; } else if ($file_ext == "mp4") { $_POST['approved'] = "queuedformp4"; } else { $_POST['approved'] = "queuedforconversion"; } } } else if ($c->requiredins == 0) { $originals_Dir = JPATH_SITE.DS.'hwdvideos'.DS.'uploads'.DS.'originals'.DS; $base_Dir = JPATH_SITE.DS.'hwdvideos'.DS.'uploads'.DS; if ($file_ext !== "flv" && $file_ext !== "mp4" && $file_ext !== "swf") { hwd_vs_tools::infomessage(4, 0, _HWDVIDS_TITLE_UPLDFAIL, _HWDVIDS_ERROR_UPLDERR04, "exclamation.png", 0); return; } if (!copy($originals_Dir.$file_name, $base_Dir.$file_video_id.".".strtolower($file_ext))) { hwd_vs_tools::infomessage(4, 0, _HWDVIDS_TITLE_UPLDFAIL, _HWDVIDS_ERROR_UPLDERR01, "exclamation.png", 0); return; } else { if ($c->deleteoriginal == 1) { if (file_exists($base_Dir.$file_name)) { @unlink($originals_Dir.$file_name); } } if ($c->aav == 1) { $_POST['approved'] = "yes"; } else { $_POST['approved'] = "pending"; } } $_POST['video_id'] = $file_video_id; } //check if already exists $db->SetQuery( 'SELECT count(*)' . ' FROM #__hwdvidsvideos' . ' WHERE video_id = "'.$file_video_id.'"' ); $duplicatecount = $db->loadResult(); if ($duplicatecount > 0) { hwd_vs_tools::infomessage(4, 0, _HWDVIDS_TITLE_UPLDFAIL, _HWDVIDS_ERROR_UPLDERR01, "exclamation.png", 0); return; } if(empty($_POST['video_id'])) { hwd_vs_tools::infomessage(4, 0, _HWDVIDS_TITLE_UPLDFAIL, _HWDVIDS_ERROR_UPLDERR01, "exclamation.png", 0); return; } // bind it to the table if (!$row->bind($_POST)) { echo "<script type=\"text/javascript\">alert('".$row->getError()."');window.history.go(-1);</script>\n"; exit(); } // store it in the db if (!$row->store()) { echo "<script type=\"text/javascript\">alert('".$row->getError()."');window.history.go(-1);</script>\n"; exit(); } include_once(JPATH_SITE.DS.'administrator'.DS.'components'.DS.'com_hwdvideoshare'.DS.'helpers'.DS.'events.php'); $params->title = $title; $params->id = $row->id; $params->category_id = $row->category_id; $params->type = $row->video_type; $params->user_id = $row->user_id; hwdvsEvent::onAfterVideoUpload($params); hwd_vs_html::uploadConfirm($title, $row); }
<?php include_once dirname(__FILE__) . "/../common/common.php"; include_once dirname(__FILE__) . '/../business/AuthB.php'; include_once dirname(__FILE__) . '/../database/Trip.php'; include_once dirname(__FILE__) . '/../database/Media.php'; $auth = new AuthB(); if (!$auth->canGetMedia()) { $response = errorResponse(RESPONSE_UNAUTHORIZED); } else { if (isPutMethod()) { $data = getPostData(); $tripId = ''; if (isset($data['tripId'])) { $tripId = $data['tripId']; } $mediaId = ''; if (isset($data['mediaId'])) { $mediaId = $data['mediaId']; } if ($tripId === '' || $mediaId === '') { $response = errorResponse(RESPONSE_BAD_REQUEST); } else { $object = new Media($tripId, $mediaId); if (isset($data['type'])) { $object->setType($data['type']); } if (isset($data['caption'])) { $object->setCaption($data['caption']); } if (isset($data['timestamp'])) {
/** * Checks if there's a new version of facileManager available * * @since 1.0 * @package facileManager */ function isNewVersionAvailable($package, $version) { $fm_site_url = 'http://www.facilemanager.com/check/'; $data['package'] = $package; $data['version'] = $version; $method = 'update'; /** Are software updates enabled? */ if (!getOption('software_update')) { return false; } /** Disable check until user has upgraded database to 1.2 */ if (getOption('fm_db_version') < 32) { return false; } /** Should we be running this check now? */ $last_version_check = getOption('version_check', 0, $package); if (!($software_update_interval = getOption('software_update_interval'))) { $software_update_interval = 'week'; } if (!$last_version_check) { $last_version_check['timestamp'] = 0; $last_version_check['data'] = null; $method = 'insert'; } elseif (strpos($last_version_check['data'], $version)) { $last_version_check['timestamp'] = 0; } if (strtotime($last_version_check['timestamp']) < strtotime("1 {$software_update_interval} ago")) { $data['software_update_tree'] = getOption('software_update_tree'); $result = getPostData($fm_site_url, $data); setOption('version_check', array('timestamp' => date("Y-m-d H:i:s"), 'data' => $result), $method, true, 0, $package); return $result; } return $last_version_check['data']; }
} /** * Check how many errors there's in the form data */ function errorsInForm($postData) { $errors = array(); // first_name if (!$postData['first_name']) { array_push($errors, 'first_name'); } // email if ($postData['email'] != "" and !filter_var($postData['email'], FILTER_VALIDATE_EMAIL) or $postData['email'] == "") { array_push($errors, 'email'); } return $errors; } // --------- PROCESS --------- // Input $postData = getPostData(); $errorsInForm = errorsInForm($postData); if (count($errorsInForm) == 0) { $data = array('first_name' => $postData['first_name'], 'email' => $postData['email']); signupEngagingNetworks($data); } // --------- Output Json $response = array(); $response['error_count'] = count($errorsInForm); $response['errors'] = $errorsInForm; $response['post'] = $postData; generate_json_output($response);
// XML parser $xml_parser->setXMLFile($TEMP_DIR, $_GET['upload_id']); // Set upload_id.redirect file $xml_parser->setXMLFileDelete($_INI['delete_redirect_file']); // Delete upload_id.redirect file when finished parsing $xml_parser->parseFeed(); // Parse upload_id.redirect file // Display message if the XML parser encountered an error if ($xml_parser->getError()) { kak($xml_parser->getErrorMsg(), 1, __LINE__, $_INI['path_to_css_file']); } $_XML_DATA = $xml_parser->getXMLData(); // Get xml data from the xml parser $_CONFIG_DATA = getConfigData($_XML_DATA); // Get config data from the xml data $_POST_DATA = getPostData($_XML_DATA); // Get post data from the xml data $_FILE_DATA = getFileData($_XML_DATA); // Get file data from the xml data // Output XML DATA, CONFIG DATA, POST DATA, FILE DATA to screen and exit if DEBUG_ENABLED. if ($_INI['debug_finished']) { debug("<br><u>XML DATA</u>", $_XML_DATA); debug("<u>CONFIG DATA</u>", $_CONFIG_DATA); debug("<u>POST DATA</u>", $_POST_DATA); debug("<u>FILE DATA</u>", $_FILE_DATA); exit; } ///////////////////////////////////////////////////////////////////////////////////////////////////// // // *** ATTENTION: ENTER YOUR CODE HERE !!! *** //
<?php require_once 'startup.php'; if (getPostData("formId") == "addExistingProject" && getPostData("projectName") && getPostData("action") == ecgettext("OK")) { $projectName = getPostData("projectName"); $updateManager = new UpdateManager(); $update = $updateManager->createUpdate("runProcedure"); $update->addItem("projectName", "/plugins/@PLUGIN_KEY@/project"); $update->addItem("procedureName", "AddProject"); $update->addItem("actualParameter", array("actualParameterName" => "project_name", "value" => $projectName)); $updateManager->handleUpdates(); $response = $update->getResponse(); $id = $response->get("jobId"); Data::$queries["getJobInfo"] = array("request" => "getJobInfo", "constantArgs" => array("jobId", $id), "result" => "job"); $limit = 10; $i = 0; while (1) { $result = QueryManager::handleQueryNow("getJobInfo"); if ($i == $limit || $result->get("status") == "completed") { break; } sleep(1); $i++; } $jobId = $result->get("jobId"); $jobName = $result->get("jobName"); $status = $result->get("status"); if ($status != "completed") { Error::report("Add job '{$jobName}' did not complete after {$limit} seconds.", "Please browse to the job details page to inspect why the job hasn't completed."); } $outcome = $result->get("outcome");
include_once 'classes/sessions.php'; include_once 'classes/login_check.php'; //upload include require 'uploader_conlib.php'; $config_video_title_length = $config['video_title_length']; //===================================START OF UPLOADER (ubber)================================ $THIS_VERSION = "4.0"; ///////////////////////////////////////////////////////////////// // The following possible query string formats are assumed // // 1. ?upload_dir=tmp_sid&path_to_upload_dir // 2. ?cmd=about ///////////////////////////////////////////////////////////////// // Hard-code the 'temp_dir' value here instead of passing it in the address bar. $temp_dir = $_REQUEST['temp_dir']; $_POST_DATA = getPostData($temp_dir, $_REQUEST['tmp_sid']); $title = $_POST_DATA['title']; $description = $_POST_DATA['description']; $tags = $_POST_DATA['tags']; $location_recorded = $_POST_DATA['location_recorded']; $allow_comments = $_POST_DATA['allow_comments']; $allow_embedding = $_POST_DATA['allow_embedding']; $public_private = $_POST_DATA['public_private']; $channel_id = $_POST_DATA['channel']; $channel_name = $_POST_DATA['channel_name']; $sub_cat = $_POST_DATA['sub_cat']; $vid_response = $_POST_DATA['vid_response']; $response_id = $_POST_DATA['response_id']; $of_channel_id = $_POST_DATA['of_channel_id']; $of_channel = $_POST_DATA['of_channel']; /////////////////////////////////////////////////////////////////////
function ww_fp_options() { echo '<div class="wrap">'; global $wpdb; if (isset($_GET['settings']) && $_GET['settings'] == '1') { if (isset($_POST['fj-set-submit'])) { update_option('f_img_path', $_POST['f_img_path']); update_option('r_img_path', $_POST['r_img_path']); echo '<div id="message" class="updated fade"><p><strong>Changes Saved</strong></p></div>'; } echo '<div class="wrap">'; echo '<div style="float:left;"><h2>Follow My Blog Post Options</h2></div><div style="float:right;margin-top:24px;"><a href="?page=followpostsettings">Main Page</a></div>'; echo '<div style="clear:both;">'; echo '<form action="" method="post">'; echo '<p> <label for="wppa-thumbsize">Follow Me: <small>Changing the URL of follow me image.</small></label><br /> <input type="text" size="60" name="f_img_path" id="wppa-tumbsize" value="' . get_option('f_img_path') . '" /> </p>'; echo '<p> <label for="wppa-fullsize">Remove Me: <small> Changing the URL of remove me image.</small></label><br /> <input type="text" size="60" name="r_img_path" id="wppa-fullsize" value="' . get_option('r_img_path') . '" /> </p>'; echo '<p> <input type="submit" name="fj-set-submit" value="Save Changes" /> </p>'; echo '</form>'; echo '</div>'; echo '</div>'; } else { if (isset($_GET['postid']) && $_GET['postid'] != '') { $mydata = getPostData($_GET['postid']); $post_title = $mydata['post_title']; if (isset($_GET['log']) && $_GET['log'] != '') { $log = $_GET['log']; echo "<h2>View Logs</h2><br />"; $sel2 = "SELECT comment_author_email FROM " . PLUGIN_Follow_Table . " where id = '" . $log . "'"; $exe = mysql_query($sel2); $data1 = mysql_fetch_assoc($exe); $email_ = $data1['comment_author_email']; $sel2 = "SELECT * FROM " . PLUGIN_Follow_Log_Table . " where user_email = '" . $email_ . "' and comment_post_ID = '" . $_GET['postid'] . "'"; $albums2 = $wpdb->get_results($sel2, 'ARRAY_A'); echo '<div style="clear:both">'; echo '<div style="float:left;height:20px;width:100px;"><b>User Mail Id : </b></div><div style="float:left;" >' . $email_ . '</div>'; echo '<div style="clear:both;float:left;height:20px;width:100px;"><b>Post Title : </b></div><div style="float:left;" >' . $post_title . '</div>'; echo '</div>'; if (!empty($albums2)) { echo '<table class="widefat" > <thead> <tr> <th scope="col">Mail Subject</th> <th scope="col">Mail Body</th> <th scope="col">Date</th> </tr> </thead>'; $alt = ' class="alternate" '; foreach ($albums2 as $data) { $mail_data = $data['mail_data']; $mailArr = explode('%$%$%', $mail_data); $datetime = new DateTime($data['log_date']); $newdate = $datetime->format('jS, F Y h:i:s A'); ?> <tr <?php echo $alt; ?> > <td><?php echo $mailArr[0]; ?> </td> <td><?php echo nl2br($mailArr[1]); ?> </td> <td><?php echo $newdate; ?> </td> </tr> <?php if ($alt == '') { $alt = ' class="alternate" '; } else { $alt = ''; } } ?> </table> <?php } else { echo "<div style='clear:both;margin-top:50px;'><b>NO Mail Sent</b></div>"; } } else { if (isset($_POST['Sub']) && $_POST['Sub'] == 'Subscribe') { //print_r($_POST); if (!empty($_POST['chkid'])) { for ($k_ = 0; $k_ < count($_POST['chkid']); $k_++) { $udp = "Update " . PLUGIN_Follow_Table . " SET follow_status = 1 where id = '" . $_POST['chkid'][$k_] . "'"; $res = mysql_query($udp); } } } if (isset($_POST['UnSub']) && $_POST['UnSub'] == 'UnSubscribe') { //print_r($_POST); if (!empty($_POST['chkid'])) { for ($k_ = 0; $k_ < count($_POST['chkid']); $k_++) { $udp = "Update " . PLUGIN_Follow_Table . " SET follow_status = 0 where id = '" . $_POST['chkid'][$k_] . "'"; $res = mysql_query($udp); } } } $postid = $_GET['postid']; echo "<h2>Subscribed Users For- " . $post_title . "</h2><br />"; $sel = "SELECT * FROM " . PLUGIN_Follow_Table . " where comment_post_ID = '" . $postid . "'"; $albums = $wpdb->get_results($sel, 'ARRAY_A'); if (!empty($albums)) { echo '<form name="formuser" method="post" action="">'; echo '<table class="widefat"> <thead> <tr> <th scope="col"></th> <th scope="col">User Email</th> <th scope="col">User Type</th> <th scope="col">Subscribed</th> <th scope="col">View Log</th> </tr> </thead>'; $alt = ' class="alternate" '; foreach ($albums as $data) { $user_id = $data['user_id']; $follow_status = $data['follow_status']; if ($user_id != '0') { $userType = 'Registered User'; } else { $userType = 'Guest'; } if ($follow_status != '0') { $followmsg = 'Yes'; } else { $followmsg = 'No'; } ?> <tr <?php echo $alt; ?> > <td><input type="checkbox" name="chkid[]" value="<?php echo $data['id']; ?> " /></td> <td><?php echo $data['comment_author_email']; ?> </td> <td><?php echo $userType; ?> </td> <td><?php echo $followmsg; ?> </td> <td><a href="<?php echo $_SERVER['REQUEST_URI'] . '&log=' . $data['id']; ?> " class="edit">View Log</a></td> </tr> <?php if ($alt == '') { $alt = ' class="alternate" '; } else { $alt = ''; } } ?> <tr> <td colspan="5"> <input type="submit" name="Sub" value="Subscribe" /> <input type="submit" name="UnSub" value="UnSubscribe" /> </td> </tr> </table> </form> <?php } else { echo "No Posts yet."; } } } else { echo '<div style="float:left;"><h2>Post List - Select A Post To View Subscribed Users</h2></div><div style="float:right;margin-top:24px;"><a href="?page=followpostsettings&settings=1">Setting Page</a></div>'; $albums = $wpdb->get_results("SELECT distinct(comment_post_ID) FROM " . PLUGIN_Follow_Table, 'ARRAY_A'); if (!empty($albums)) { echo '<table class="widefat"> <thead> <tr> <th scope="col">Post Name</th> <th scope="col">View Uses</th> </tr> </thead>'; $alt = ' class="alternate" '; foreach ($albums as $data) { $Pdata = getPostData($data['comment_post_ID']); $post_title = $Pdata['post_title']; ?> <tr <?php echo $alt; ?> ><td><?php echo $post_title; ?> </td> <td><a href="<?php echo $_SERVER['REQUEST_URI'] . '&postid=' . $data['comment_post_ID']; ?> " class="edit">View Users</a></td> </tr> <?php if ($alt == '') { $alt = ' class="alternate" '; } else { $alt = ''; } } echo '</table>'; } else { echo "No Posts yet."; } } } echo '</div>'; }
/** * Processes the update method and prepares the system * * @since 1.0 * @package facileManager * * @param string $module_name Module currently being used * @param string $update_method User entered update method * @return string */ function processUpdateMethod($module_name, $update_method, $data, $url) { global $argv; switch ($update_method) { /** cron */ case 'c': $tmpfile = sys_get_temp_dir() . '/crontab.facileManager'; $dump = shell_exec('crontab -l | grep -v ' . $argv[0] . '> ' . $tmpfile . ' 2>/dev/null'); /** Handle special cases */ if (PHP_OS == 'SunOS') { for ($x = 0; $x < 12; $x++) { $minopt[] = sprintf("%02d", $x * 5); } $minutes = implode(',', $minopt); unset($minopt); } else { $minutes = '*/5'; } $cmd = "echo '" . $minutes . ' * * * * ' . findProgram('php') . ' ' . dirname(__FILE__) . '/' . $module_name . '/' . basename($argv[0]) . " cron' >> {$tmpfile} && " . findProgram('crontab') . ' ' . $tmpfile; $cron_update = system($cmd, $retval); unlink($tmpfile); if ($retval) { echo fM(" --> The crontab cannot be created.\n --> {$cmd}\n"); } else { echo fM(" --> The crontab has been created.\n"); } return 'cron'; break; /** ssh */ /** ssh */ case 's': $raw_data = getPostData(str_replace('genserial', 'ssh=user', $url), $data); $user = $data['compress'] ? @unserialize(gzuncompress($raw_data)) : @unserialize($raw_data); $result = $user ? 'ok' : 'failed'; if ($result == 'failed') { echo fM("Installation failed. No SSH user found for this account.\n"); exit(1); } /** Get local users */ $passwd_users = explode("\n", preg_replace('/:.*/', '', @file_get_contents('/etc/passwd'))); /** Add fm_user */ echo fM(" --> Attempting to create system user ({$user})..."); if (!($ssh_dir = addUser(array($user, 'facileManager'), $passwd_users))) { echo "failed\n"; echo fM("\nInstallation aborted.\n"); exit(1); } else { echo "ok\n"; } /** Add ssh public key */ echo fM(" --> Installing SSH key..."); $raw_data = getPostData(str_replace('genserial', 'ssh=key_pub', $url), $data); $raw_data = $data['compress'] ? @unserialize(gzuncompress($raw_data)) : @unserialize($raw_data); if (strpos($raw_data, 'ssh-rsa') !== false) { $result = strpos(@file_get_contents($ssh_dir . '/authorized_keys2'), $raw_data) === false ? @file_put_contents($ssh_dir . '/authorized_keys2', $raw_data, FILE_APPEND) : true; @chown($ssh_dir . '/authorized_keys2', $user); @chmod($ssh_dir . '/authorized_keys2', 0600); if ($result !== false) { $result = 'ok'; } } else { $result = 'failed'; } echo $result . "\n\n"; if ($result == 'failed') { echo fM("Installation failed. No SSH key found for this account.\n"); exit(1); } /** Add an entry to sudoers */ $sudoers_line = "{$user}\tALL=(root)\tNOPASSWD: " . findProgram('php') . ' ' . $argv[0] . ' *'; addSudoersConfig($module_name, $sudoers_line, $user); return 'ssh'; break; /** http(s) */ /** http(s) */ case 'h': /** Detect which web server is running */ $web_server = detectHttpd(); if (!is_array($web_server)) { echo fM("\nCannot find a supported web server - please check the README document for supported web servers. Aborting.\n"); exit(1); } /** Add a symlink to the docroot */ $httpdconf = findFile($web_server['file']); if (!$httpdconf) { echo fM("\nCannot find " . $web_server['file'] . '. Please enter the full path of ' . $web_server['file'] . ' (/etc/httpd/conf/httpd.conf): '); $httpdconf = trim(strtolower(fgets(STDIN))); /** Check if the file exists */ if (!is_file($httpdconf)) { echo fM(" --> {$httpdconf} does not exist. Aborting.\n"); exit(1); } } /** Get the docroot from STDIN if it's not found */ if (!($docroot = getParameterValue('^DocumentRoot', $httpdconf, '"'))) { echo fM("\nCannot find DocumentRoot in " . $web_server['file'] . ". Please enter the full path of your default DocumentRoot (/var/www/html): "); $docroot = rtrim(trim(strtolower(fgets(STDIN))), '/'); } /** Check if the docroot exists */ if (!is_dir($docroot)) { echo fM(" --> {$docroot} does not exist. Aborting.\n"); exit(1); } $link_name = $docroot . DIRECTORY_SEPARATOR . $module_name; echo fM(" --> Creating {$link_name} link.\n"); if (!is_link($link_name)) { symlink(dirname(__FILE__) . '/' . $module_name . '/www', $link_name); } else { echo fM(" --> {$link_name} already exists...skipping\n"); } /** Add an entry to sudoers */ $user = getParameterValue('^User', $httpdconf, ' '); if ($user[0] == '$') { $user_var = preg_replace(array('/\\$/', '/{/', '/}/'), '', $user); $user = getParameterValue($user_var, findFile('envvars'), '='); } echo fM(' --> Detected ' . $web_server['app'] . " runs as '{$user}'\n"); $sudoers_line = "{$user}\tALL=(root)\tNOPASSWD: " . findProgram('php') . ' ' . $argv[0] . ' *'; addSudoersConfig($module_name, $sudoers_line, $user); return 'http'; break; } }
function buildZoneConfig($domain_id) { global $fmdb, $__FM_CONFIG, $fm_name; /** Check domain_id and soa */ $parent_domain_ids = getZoneParentID($domain_id); if (!isset($parent_domain_ids[2])) { $query = "SELECT * FROM fm_{$__FM_CONFIG['fmDNS']['prefix']}domains d, fm_{$__FM_CONFIG['fmDNS']['prefix']}soa s WHERE domain_status='active' AND d.account_id='{$_SESSION['user']['account_id']}' AND s.soa_id=d.soa_id AND d.domain_id IN (" . join(',', $parent_domain_ids) . ")"; } else { $query = "SELECT * FROM fm_{$__FM_CONFIG['fmDNS']['prefix']}domains d, fm_{$__FM_CONFIG['fmDNS']['prefix']}soa s WHERE domain_status='active' AND d.account_id='{$_SESSION['user']['account_id']}' AND\n\t\t\t\ts.soa_id=(SELECT soa_id FROM fm_dns_domains WHERE domain_id={$parent_domain_ids[2]})"; } $result = $fmdb->query($query); if (!$fmdb->num_rows) { return sprintf('<p class="error">%s</p>' . "\n", __('Failed: There was no SOA record found for this zone.')); } $domain_details = $fmdb->last_result; extract(get_object_vars($domain_details[0]), EXTR_SKIP); $name_servers = $this->getNameServers($domain_name_servers, array('masters')); /** No name servers so return */ if (!$name_servers) { return sprintf('<p class="error">%s</p>' . "\n", __('There are no DNS servers hosting this zone.')); } /** Loop through name servers */ $name_server_count = $fmdb->num_rows; $response = '<textarea rows="12" cols="85">'; $failures = false; for ($i = 0; $i < $name_server_count; $i++) { switch ($name_servers[$i]->server_update_method) { case 'cron': /** Add records to fm_{$__FM_CONFIG['fmDNS']['prefix']}track_reloads */ foreach ($this->getZoneCloneChildren($domain_id) as $child_id) { $this->addZoneReload($name_servers[$i]->server_serial_no, $child_id); } /** Set the server_update_config flag */ setBuildUpdateConfigFlag($name_servers[$i]->server_serial_no, 'yes', 'update'); $response .= '[' . $name_servers[$i]->server_name . '] ' . __('This zone will be updated on the next cron run.') . "\n"; break; case 'http': case 'https': /** Test the port first */ if (!socketTest($name_servers[$i]->server_name, $name_servers[$i]->server_update_port, 10)) { $response .= '[' . $name_servers[$i]->server_name . '] ' . sprintf(__('Failed: could not access %s (tcp/%d).'), $name_servers[$i]->server_update_method, $name_servers[$i]->server_update_port) . "\n"; $failures = true; break; } /** Remote URL to use */ $url = $name_servers[$i]->server_update_method . '://' . $name_servers[$i]->server_name . ':' . $name_servers[$i]->server_update_port . '/' . $_SESSION['module'] . '/reload.php'; /** Data to post to $url */ $post_data = array('action' => 'reload', 'serial_no' => $name_servers[$i]->server_serial_no, 'domain_id' => $domain_id); $post_result = unserialize(getPostData($url, $post_data)); if (!is_array($post_result)) { /** Something went wrong */ return '<div class="error"><p>' . $post_result . '</p></div>' . "\n"; } else { if (count($post_result) > 1) { /** Loop through and format the output */ foreach ($post_result as $line) { $response .= '[' . $name_servers[$i]->server_name . "] {$line}\n"; if (strpos(strtolower($line), 'fail')) { $failures = true; } } } else { $response .= "[{$name_servers[$i]->server_name}] " . $post_result[0] . "\n"; if (strpos(strtolower($post_result[0]), 'fail')) { $failures = true; } } } /** Set the server_update_config flag */ setBuildUpdateConfigFlag($name_servers[$i]->server_serial_no, 'yes', 'update'); break; case 'ssh': /** Test the port first */ if (!socketTest($name_servers[$i]->server_name, $name_servers[$i]->server_update_port, 10)) { $response .= '[' . $name_servers[$i]->server_name . '] ' . sprintf(__('Failed: could not access %s (tcp/%d).'), $name_servers[$i]->server_update_method, $name_servers[$i]->server_update_port) . "\n"; $failures = true; break; } /** Get SSH key */ $ssh_key = getOption('ssh_key_priv', $_SESSION['user']['account_id']); if (!$ssh_key) { return '<p class="error">' . sprintf(__('Failed: SSH key is not <a href="%s">defined</a>.'), getMenuURL(_('Settings'))) . '</p>' . "\n"; } $temp_ssh_key = sys_get_temp_dir() . '/fm_id_rsa'; if (file_exists($temp_ssh_key)) { @unlink($temp_ssh_key); } if (@file_put_contents($temp_ssh_key, $ssh_key) === false) { return '<p class="error">' . sprintf(__('Failed: could not load SSH key into %s.'), $temp_ssh_key) . '</p>' . "\n"; } @chmod($temp_ssh_key, 0400); $ssh_user = getOption('ssh_user', $_SESSION['user']['account_id']); if (!$ssh_user) { return '<p class="error">' . sprintf(__('Failed: SSH user is not <a href="%s">defined</a>.'), getMenuURL(_('Settings'))) . '</p>' . "\n"; } unset($post_result); exec(findProgram('ssh') . " -t -i {$temp_ssh_key} -o 'StrictHostKeyChecking no' -p {$name_servers[$i]->server_update_port} -l {$ssh_user} {$name_servers[$i]->server_name} 'sudo php /usr/local/{$fm_name}/{$_SESSION['module']}/dns.php zones id={$domain_id}'", $post_result, $retval); @unlink($temp_ssh_key); if (!is_array($post_result)) { /** Something went wrong */ return sprintf('<p class="error">%s</p>' . "\n", $post_result); } else { if (!count($post_result)) { $post_result[] = __('Zone reload was successful.'); } if (count($post_result) > 1) { /** Loop through and format the output */ foreach ($post_result as $line) { $response .= '[' . $name_servers[$i]->server_name . "] {$line}\n"; if (strpos(strtolower($line), 'fail')) { $failures = true; } } } else { $response .= "[{$name_servers[$i]->server_name}] " . $post_result[0] . "\n"; if (strpos(strtolower($post_result[0]), 'fail')) { $failures = true; } } } /** Set the server_update_config flag */ setBuildUpdateConfigFlag($name_servers[$i]->server_serial_no, 'yes', 'update'); break; } } $response .= "</textarea>\n"; /** Reset the domain_reload flag */ if (!$failures) { global $fm_dns_records; if (!isset($fm_dns_records)) { include ABSPATH . 'fm-modules/fmDNS/classes/class_records.php'; } $fm_dns_records->updateSOAReload($domain_id, 'no'); } addLogEntry(sprintf(__("Reloaded zone '%s'."), displayFriendlyDomainName($domain_name))); return $response; }
function versionCheck($app_version, $serverhost, $compress) { $url = $serverhost . '/buildconf'; $data['action'] = 'version_check'; $server_type = detectFirewallType(); $data['server_type'] = $server_type['type']; $data['server_version'] = $app_version; $data['compress'] = $compress; $raw_data = getPostData($url, $data); $raw_data = $compress ? @unserialize(gzuncompress($raw_data)) : @unserialize($raw_data); return $raw_data; }
//kustutame kõik session muutujad ja peatame sessiooni session_destroy(); header("Location: page/login.php"); } // kas kustutame // ?delete=vastav id mida kustutada on aadressi real if (isset($_GET["delete"])) { echo "Kustutame id " . $_GET["delete"]; //käivitan funktsiooni, saadan kaasa id! deleteReview($_GET["delete"]); } if (isset($_POST["save"])) { updatePost($_POST["id"], $_POST["post"]); } //käivitan funktsiooni $array_of_posts = getPostData(); ?> <div> <br> <p><a href="data.php" class="btn btn-primary" role="button">Tagasi teemade lehele</a></p> <body style="background-color:#0074D9"> <h2 style=color:#F8F8FF>Postitused Eesti jalgpallist</h2> <p><a href="mingiteema.php" class="btn btn-primary" role="button" style="text-align:left;color:#F8F8FF">Loo ise arvustus</a></p> <style> .CSSTableGenerator {
<?php require_once 'startup.php'; if (getPostData("formId") == "createVersionedProject" && getPostData("projectName") && getPostData("action") == ecgettext("OK")) { $projectName = getPostData("projectName"); $updateManager = new UpdateManager(); $update = $updateManager->createUpdate("runProcedure"); $update->addItem("projectName", "/plugins/@PLUGIN_KEY@/project"); $update->addItem("procedureName", "CreateProject"); $update->addItem("actualParameter", array("actualParameterName" => "project_name", "value" => $projectName)); $update->addItem("actualParameter", array("actualParameterName" => "project_description", "value" => getPostData("description"))); $update->addItem("actualParameter", array("actualParameterName" => "default_resource", "value" => getPostData("resourceName"))); $update->addItem("actualParameter", array("actualParameterName" => "default_workspace", "value" => getPostData("workspaceName"))); $updateManager->handleUpdates(); $response = $update->getResponse(); $id = $response->get("jobId"); Data::$queries["getJobInfo"] = array("request" => "getJobInfo", "constantArgs" => array("jobId", $id), "result" => "job"); $limit = 10; $i = 0; while (1) { $result = QueryManager::handleQueryNow("getJobInfo"); if ($i == $limit || $result->get("status") == "completed") { break; } sleep(1); $i++; } $jobId = $result->get("jobId"); $jobName = $result->get("jobName"); $status = $result->get("status"); if ($status != "completed") {
include_once $base . '/changeRank.php'; include_once $base . '/shout.php'; // Remember to include other functions if you want to use them! libxml_use_internal_errors(true); // Hide DOMDocument warnings (though your errors should be turned off anyways) $group = 18; // Change this to your group ID $cookieTime = $base . '/Private/cookieTime.txt'; if (!file_exists($cookieTime)) { file_put_contents($cookieTime, 0); } $cookie = $base . '/Private/cookie'; if (time() - file_get_contents($cookieTime) > 86400) { login($cookie, 'username', 'password'); file_put_contents($cookieTime, time()); } $data = getPostData(true); if (!$data || !array_key_exists('Validate', $data) || $data['Validate'] != $postKey) { die('FAILURE: Incorrect/missing validation key.'); } switch ($data['Action']) { case 'setRank': list($ranks, $roles) = getRoleSets($group); echo updateRank($group, $data['Parameter1'], $data['Parameter2'], $cookie, $ranks, $roles, 9, $base . '/Private/gxcsrf.txt'); break; case 'shout': echo shout($cookie, $group, $data['Parameter1']); break; default: die('No action!'); }
/** * Upgrades the client sotware * * @since 1.1 * @package facileManager */ function doClientUpgrade($serial_no) { global $fmdb, $__FM_CONFIG, $fm_name; /** Check permissions */ if (!currentUserCan('manage_servers', $_SESSION['module'])) { echo buildPopup('header', _('Error')); printf('<p>%s</p>', _('You do not have permission to manage servers.')); echo buildPopup('footer', _('OK'), array('cancel_button' => 'cancel')); exit; } /** Process server group */ if ($serial_no[0] == 'g') { $group_servers = $this->getGroupServers(substr($serial_no, 1)); if (!is_array($group_servers)) { return $group_servers; } $response = null; foreach ($group_servers as $serial_no) { if (is_numeric($serial_no)) { $response .= $this->doClientUpgrade($serial_no) . "\n"; } } return $response; } /** Check serial number */ basicGet('fm_' . $__FM_CONFIG[$_SESSION['module']]['prefix'] . 'servers', sanitize($serial_no), 'server_', 'server_serial_no'); if (!$fmdb->num_rows) { return sprintf(_('%d is not a valid serial number.'), $serial_no); } $server_details = $fmdb->last_result; extract(get_object_vars($server_details[0]), EXTR_SKIP); $response[] = $server_name; if ($server_installed != 'yes') { $response[] = ' --> ' . _('Failed: Client is not installed.') . "\n"; } if (count($response) == 1) { switch ($server_update_method) { case 'cron': /* Servers updated via cron require manual upgrades */ $response[] = ' --> ' . _('This server needs to be upgraded manually with the following command:'); $response[] = " --> sudo php /usr/local/{$fm_name}/{$_SESSION['module']}/\$(ls /usr/local/{$fm_name}/{$_SESSION['module']} | grep php | grep -v functions) upgrade"; addLogEntry(sprintf(_('Upgraded client scripts on %s.'), $server_name)); break; case 'http': case 'https': /** Test the port first */ if (!socketTest($server_name, $server_update_port, 10)) { $response[] = ' --> ' . sprintf(_('Failed: could not access %s using %s (tcp/%d).'), $server_name, $server_update_method, $server_update_port); break; } /** Remote URL to use */ $url = $server_update_method . '://' . $server_name . ':' . $server_update_port . '/' . $_SESSION['module'] . '/reload.php'; /** Data to post to $url */ $post_data = array('action' => 'upgrade', 'serial_no' => $server_serial_no); $post_result = @unserialize(getPostData($url, $post_data)); if (!is_array($post_result)) { /** Something went wrong */ if (empty($post_result)) { $response[] = ' --> ' . sprintf(_('It appears %s does not have php configured properly within httpd or httpd is not running.'), $server_name); break; } } else { if (count($post_result) > 1) { /** Loop through and format the output */ foreach ($post_result as $line) { if (strlen(trim($line))) { $response[] = " --> {$line}"; } } } else { $response[] = " --> " . $post_result[0]; } addLogEntry(sprintf(_('Upgraded client scripts on %s.'), $server_name)); } break; case 'ssh': /** Test the port first */ if (!socketTest($server_name, $server_update_port, 10)) { $response[] = ' --> ' . sprintf(_('Failed: could not access %s using %s (tcp/%d).'), $server_name, $server_update_method, $server_update_port); break; } /** Get SSH key */ $ssh_key = getOption('ssh_key_priv', $_SESSION['user']['account_id']); if (!$ssh_key) { $response[] = ' --> ' . sprintf(_('Failed: SSH key is not %sdefined</a>.'), '<a href="' . getMenuURL(_('General')) . '">'); break; } $temp_ssh_key = sys_get_temp_dir() . '/fm_id_rsa'; if (file_exists($temp_ssh_key)) { @unlink($temp_ssh_key); } if (@file_put_contents($temp_ssh_key, $ssh_key) === false) { $response[] = ' --> ' . sprintf(_('Failed: could not load SSH key into %s.'), $temp_ssh_key); break; } @chmod($temp_ssh_key, 0400); $ssh_user = getOption('ssh_user', $_SESSION['user']['account_id']); if (!$ssh_user) { return sprintf('<p class="error">%s</p>' . "\n", sprintf(_('Failed: SSH user is not <a href="%s">defined</a>.'), getMenuURL(_('General')))); } unset($post_result); exec(findProgram('ssh') . " -t -i {$temp_ssh_key} -o 'StrictHostKeyChecking no' -p {$server_update_port} -l {$ssh_user} {$server_name} 'sudo php /usr/local/{$fm_name}/{$_SESSION['module']}/\$(ls /usr/local/{$fm_name}/{$_SESSION['module']} | grep php | grep -v functions) upgrade 2>&1'", $post_result, $retval); @unlink($temp_ssh_key); if ($retval) { /** Something went wrong */ $post_result[] = _('Client upgrade failed.'); } else { if (!count($post_result)) { $post_result[] = _('Config build was successful.'); addLogEntry(sprintf(_('Upgraded client scripts on %s.'), $server_name)); } } if (count($post_result) > 1) { /** Loop through and format the output */ foreach ($post_result as $line) { if (strlen(trim($line))) { $response[] = " --> {$line}"; } } } else { $response[] = " --> " . $post_result[0]; } break; } $response[] = null; } return implode("\n", $response); }
<?php session_start(); $post = getPostData(); if ($post['password'] && sha1($post['password']) === '6d99318bbf59a79d891709cd691bd31b4f00f894') { $_SESSION['loggedIn'] = true; echo 'success'; exit; } function getPostData() { $data = json_decode(file_get_contents('php://input'), true); if ($data === null && count($_POST)) { $data = $_POST; } return $data; }
function sc_blogger($atts, $content = null) { if (in_shortcode_blogger(true)) { return ''; } extract(shortcode_atts(array("id" => "", "class" => "", "style" => "regular", "filters" => "no", "ids" => "", "cat" => "", "count" => "3", "visible" => "", "offset" => "", "orderby" => "date", "order" => "desc", "only" => "no", "descr" => "0", "readmore" => "", "loadmore" => "no", "location" => "default", "dir" => "horizontal", "hover" => get_theme_option('hover_style'), "hover_dir" => get_theme_option('hover_dir'), "scroll" => "no", "controls" => "no", "rating" => "no", "info" => "yes", "links" => "yes", "date_format" => "", "width" => "", "height" => "", "top" => "", "bottom" => "", "left" => "", "right" => ""), $atts)); $s = getStyleString($top, $right, $bottom, $left, $width, $height); $width = getStyleValue($width); $height = getStyleValue($height); global $THEMEREX_sc_blogger_busy, $THEMEREX_sc_blogger_counter, $post; $THEMEREX_sc_blogger_busy = true; $THEMEREX_sc_blogger_counter = 0; if (empty($id)) { $id = "sc_blogger_" . str_replace('.', '', mt_rand()); } if ($style == 'date' && empty($date_format)) { $date_format = 'd.m+Y'; } if (!in_array($style, array('regular', 'date', 'image_large', 'image_medium', 'image_small', 'image_tiny', 'accordion_1', 'accordion_2', 'list', 'excerpt', 'related')) && !in_array(themerex_substr($style, 0, 7), array('classic', 'masonry', 'portfol'))) { $style = 'regular'; } if (!empty($ids)) { $posts = explode(',', str_replace(' ', '', $ids)); $count = count($posts); } if (in_array($style, array('accordion_1', 'accordion_2', 'list'))) { $dir = 'vertical'; } if ($visible <= 0) { $visible = min(4, $count); } if (sc_param_is_on($scroll) && empty($id)) { $id = 'sc_blogger_' . str_replace('.', '', mt_rand()); } $output = ($style == 'list' ? '<ul' : '<div') . ($id ? ' id="' . $id . '"' : '') . ' class="sc_blogger' . (!empty($class) ? ' ' . $class : '') . ' sc_blogger_' . ($dir == 'vertical' ? 'vertical' : 'horizontal') . ' style_' . (in_array($style, array('accordion_1', 'accordion_2')) ? 'accordion' : (themerex_strpos($style, 'image') !== false ? 'image style_' : '') . $style) . (in_array($style, array('accordion_1', 'accordion_2')) ? ' sc_accordion' : '') . ($style == 'accordion_1' ? ' sc_accordion_style_1' : '') . ($style == 'accordion_2' ? ' sc_accordion_style_2' : '') . (themerex_strpos($style, 'masonry') !== false || themerex_strpos($style, 'classic') !== false ? ' masonryWrap' : '') . (themerex_strpos($style, 'portfolio') !== false ? ' portfolioWrap' : '') . ($style == 'related' ? ' relatedPostWrap' : '') . (sc_param_is_on($scroll) && sc_param_is_on($controls) ? ' sc_scroll_controls sc_scroll_controls_' . $dir : '') . ($descr == 0 ? ' no_description' : '') . '"' . ($s != '' ? ' style="' . $s . '"' : '') . '>' . ($dir != 'vertical' && $style != 'date' && !in_array(themerex_substr($style, 0, 7), array('classic', 'masonry', 'portfol', 'excerpt')) ? '<div class="columnsWrap">' : '') . (sc_param_is_on($scroll) ? '<div id="' . $id . '_scroll" class="sc_scroll sc_scroll_' . $dir . ' sc_slider_noresize swiper-slider-container scroll-container"' . ' style="' . ($dir == 'vertical' ? 'height:' . ($height != '' ? $height : "230px") . ';' : 'width:' . ($width != '' ? $width : "100%") . ';') . '"' . '>' . '<div class="sc_scroll_wrapper swiper-wrapper">' . '<div class="sc_scroll_slide swiper-slide">' : ''); if (themerex_strpos($style, 'masonry') !== false || themerex_strpos($style, 'classic') !== false) { if (!sc_param_is_off($filters)) { $output .= '<div class="isotopeFiltr"></div>'; } $output .= '<section class="masonry ' . (!sc_param_is_off($filters) ? 'isotope' : 'isotopeNOanim') . '" data-columns="' . themerex_substr($style, -1) . '">'; } else { if (themerex_strpos($style, 'portfolio') !== false) { if (!sc_param_is_off($filters)) { $output .= '<div class="isotopeFiltr"></div>'; } $output .= '<section class="portfolio ' . (!sc_param_is_off($filters) ? 'isotope' : 'isotopeNOanim') . ' folio' . themerex_substr($style, -1) . 'col" data-columns="' . themerex_substr($style, -1) . '">'; } } $args = array('post_status' => current_user_can('read_private_pages') && current_user_can('read_private_posts') ? array('publish', 'private') : 'publish', 'posts_per_page' => $count, 'ignore_sticky_posts' => 1, 'order' => $order == 'asc' ? 'asc' : 'desc', 'orderby' => 'date'); if ($offset > 0 && empty($ids)) { $args['offset'] = $offset; } $args = addSortOrderInQuery($args, $orderby, $order); if (!sc_param_is_off($only)) { $args = addFiltersInQuery($args, array($only)); } $args = addPostsAndCatsInQuery($args, $ids, $cat); $query = new WP_Query($args); $flt_ids = array(); while ($query->have_posts()) { $query->the_post(); $THEMEREX_sc_blogger_counter++; $args = array('layout' => in_array(themerex_substr($style, 0, 7), array('classic', 'masonry', 'portfol', 'excerpt', 'related')) ? themerex_substr($style, 0, 7) : 'blogger', 'show' => false, 'number' => $THEMEREX_sc_blogger_counter, 'add_view_more' => false, 'posts_on_page' => $count > 0 ? $count : $query->found_posts, "location" => $location, "descr" => $descr, "readmore" => $readmore, "loadmore" => $loadmore, "reviews" => sc_param_is_on($rating), "dir" => $dir, "scroll" => sc_param_is_on($scroll), "info" => sc_param_is_on($info), "links" => sc_param_is_on($links), "orderby" => $orderby, "posts_visible" => $visible, "date_format" => $date_format, 'thumb_size' => $style, 'thumb_crop' => themerex_strpos($style, 'masonry') === false, 'strip_teaser' => false, "categories_list" => in_array($style, array('excerpt')) || $filters == 'categories', "tags_list" => in_array(themerex_substr($style, 0, 7), array('classic', 'masonry', 'portfol', 'related')) || $filters == 'tags', 'filters' => sc_param_is_off($filters) ? '' : $filters, 'hover' => $hover, 'hover_dir' => $hover_dir); $post_data = getPostData($args); $output .= showPostLayout($args, $post_data); if (!sc_param_is_off($filters)) { if ($filters == 'tags') { // Use tags as filter items if (count($post_data['post_tags_list']) > 0) { foreach ($post_data['post_tags_list'] as $tag) { $flt_ids[$tag->term_id] = $tag->name; } } } } } wp_reset_postdata(); if (in_array(themerex_substr($style, 0, 7), array('classic', 'masonry', 'portfol'))) { if (themerex_strpos($style, 'masonry') !== false || themerex_strpos($style, 'classic') !== false) { $output .= '</section>'; } else { if (themerex_strpos($style, 'portfolio') !== false) { $output .= '</section>'; } } // Isotope filters list $filters_list = ''; if (!sc_param_is_off($filters)) { if ($filters == 'categories') { // Use categories as filter items $portfolio_parent = max(0, getParentCategoryByProperty($cat, 'show_filters', 'yes')); $args2 = array('type' => 'post', 'child_of' => $portfolio_parent, 'orderby' => 'name', 'order' => 'ASC', 'hide_empty' => 1, 'hierarchical' => 0, 'exclude' => '', 'include' => '', 'number' => '', 'taxonomy' => 'category', 'pad_counts' => false); $portfolio_list = get_categories($args2); if (count($portfolio_list) > 0) { $filters_list .= '<li class="squareButton' . ($portfolio_parent == $cat_id ? ' active' : '') . '"><a href="#" data-filter="*">' . __('All', 'themerex') . '</a></li>'; foreach ($portfolio_list as $cat) { $filters_list .= '<li class="squareButton' . ($cat->term_id == $cat_id ? ' active' : '') . '"><a href="#" data-filter=".flt_' . $cat->term_id . '">' . $cat->name . '</a></li>'; } } } else { // Use tags as filter items if (count($flt_ids) > 0) { $filters_list .= '<li class="squareButton active"><a href="#" data-filter="*">' . __('All', 'themerex') . '</a></li>'; foreach ($flt_ids as $flt_id => $flt_name) { $filters_list .= '<li class="squareButton"><a href="#" data-filter=".flt_' . $flt_id . '">' . $flt_name . '</a></li>'; } } } if ($filters_list) { $output .= '<script type="text/javascript">' . 'jQuery(document).ready(function () {' . 'jQuery("#' . $id . ' .isotopeFiltr").append("<ul>' . addslashes($filters_list) . '</ul>");' . '});' . '</script>'; } } } $output .= (sc_param_is_on($scroll) ? '</div></div><div id="' . $id . '_scroll_bar" class="sc_scroll_bar sc_scroll_bar_' . $dir . ' ' . $id . '_scroll_bar"></div></div>' . (sc_param_is_on($controls) ? '<ul class="flex-direction-nav"><li><a class="flex-prev" href="#"></a></li><li><a class="flex-next" href="#"></a></li></ul>' : '') : '') . ($dir != 'vertical' && $style != 'date' && !in_array(themerex_substr($style, 0, 7), array('classic', 'masonry', 'portfol', 'excerpt')) ? '</div>' : '') . ($style == 'list' ? '</ul>' : '</div>'); if (in_array($style, array('accordion_1', 'accordion_2'))) { themerex_enqueue_script('jquery-ui-accordion', false, array('jquery', 'jquery-ui-core'), null, true); } $THEMEREX_sc_blogger_busy = false; return $output; }
$_POST_DATA = array(); // Array of posted data read from the $_XML_DATA array $_FILE_DATA = array(); // Array of 'FileInfo' objects read from the $_XML_DATA array $_FILE_DATA_TABLE = ''; // String used to store file info results nested between <tr> tags $_FILE_DATA_EMAIL = ''; // String used to store file info results $xml_parser = new XML_Parser; // XML parser $xml_parser->setXMLFile($TEMP_DIR, $_REQUEST['upload_id']); // Set upload_id.redirect file $xml_parser->setXMLFileDelete($DELETE_REDIRECT_FILE); // Delete upload_id.redirect file when finished parsing $xml_parser->parseFeed(); // Parse upload_id.redirect file // Display message if the XML parser encountered an error if($xml_parser->getError()){ kak($xml_parser->getErrorMsg(), 1, __LINE__); } $_XML_DATA = $xml_parser->getXMLData(); // Get xml data from the xml parser $_CONFIG_DATA = getConfigData($_XML_DATA); // Get config data from the xml data $_POST_DATA = getPostData($_XML_DATA); // Get post data from the xml data $_FILE_DATA = getFileData($_XML_DATA); // Get file data from the xml data // Output XML DATA, CONFIG DATA, POST DATA, FILE DATA to screen and exit if DEBUG_ENABLED. if($DEBUG_FINISHED){ debug("<br><u>XML DATA</u>", $_XML_DATA); debug("<u>CONFIG DATA</u>", $_CONFIG_DATA); debug("<u>POST DATA</u>", $_POST_DATA); debug("<u>FILE DATA</u><br>", $_FILE_DATA); exit; } ///////////////////////////////////////////////////////////////////////////////////////////////// //
<?php require_once 'startup.php'; $projectName = getGet("projectName"); if (getPostData("formId") == "commitVersionedProject" && getPostData("action") == ecgettext("OK")) { $comment = getPostData("comment"); if ($comment == "") { Error::formError(ecgettext("A commit comment is required."), "comment"); } $updateManager = new UpdateManager(); $update = $updateManager->createUpdate("runProcedure"); $update->addItem("projectName", "/plugins/@PLUGIN_KEY@/project"); $update->addItem("procedureName", "CommitProjectChanges"); $update->addItem("actualParameter", array("actualParameterName" => "project_name", "value" => $projectName)); $update->addItem("actualParameter", array("actualParameterName" => "comment", "value" => $comment)); $updateManager->handleUpdates(); $response = $update->getResponse(); $id = $response->get("jobId"); Data::$queries["getJobInfo"] = array("request" => "getJobInfo", "constantArgs" => array("jobId", $id), "result" => "job"); $limit = 10; $i = 0; while (1) { $result = QueryManager::handleQueryNow("getJobInfo"); if ($i == $limit || $result->get("status") == "completed") { break; } sleep(1); $i++; } $jobId = $result->get("jobId"); $jobName = $result->get("jobName");
function versionCheck($app_version, $serverhost, $compress) { $url = str_replace(':/', '://', str_replace('//', '/', $serverhost . '/buildconf.php')); $data['action'] = 'version_check'; $server_type = detectServerType(); $data['server_type'] = $server_type['type']; $data['server_version'] = $app_version; $data['compress'] = $compress; $raw_data = getPostData($url, $data); $raw_data = $compress ? @unserialize(gzuncompress($raw_data)) : @unserialize($raw_data); return $raw_data; }
function themerex_callback_view_more_posts() { global $_REQUEST, $post, $wp_query; if (!wp_verify_nonce($_REQUEST['nonce'], 'ajax_nonce')) { die; } $response = array('error' => '', 'data' => '', 'no_more_data' => 0); $page = $_REQUEST['page']; $args = unserialize(stripslashes($_REQUEST['data'])); $vars = unserialize(stripslashes($_REQUEST['vars'])); if ($page > 0 && is_array($args) && is_array($vars)) { extract($vars); $args['page'] = $page; $args['paged'] = $page; $args['ignore_sticky_posts'] = 1; if (!isset($wp_query)) { $wp_query = new WP_Query($args); } else { query_posts($args); } $per_page = count($wp_query->posts); $response['no_more_data'] = $page >= $wp_query->max_num_pages; //$per_page < $ppp; $post_number = 0; $accent_color = ''; $response['data'] = ''; $flt_ids = array(); while (have_posts()) { the_post(); $post_number++; $post_args = array('layout' => in_array(themerex_substr($vars['blog_style'], 0, 7), array('classic', 'masonry', 'portfol')) ? themerex_substr($vars['blog_style'], 0, 7) : $vars['blog_style'], 'number' => $post_number, 'add_view_more' => false, 'posts_on_page' => $per_page, 'thumb_size' => $vars['blog_style'], 'thumb_crop' => themerex_strpos($vars['blog_style'], 'masonry') === false, 'strip_teaser' => false, 'parent_cat_id' => $vars['parent_cat_id'], 'sidebar' => !in_array($vars['show_sidebar_main'], array('none', 'fullwidth')), 'filters' => $vars['filters'], 'hover' => $vars['hover'], 'show' => false); $post_data = getPostData($post_args); $response['data'] .= showPostLayout($post_args, $post_data); if ($vars['filters'] == 'tags') { if (count($post_data['post_tags_list']) > 0) { foreach ($post_data['post_tags_list'] as $tag) { $flt_ids[$tag->term_id] = $tag->name; } } } } $response['filters'] = $flt_ids; } else { $response['error'] = __('Wrong query arguments', 'themerex'); } echo json_encode($response); die; }
function themerex_callback_view_more_posts() { global $_REQUEST, $post, $wp_query; if (!wp_verify_nonce($_REQUEST['nonce'], 'ajax_nonce')) { die; } $response = array('error' => '', 'data' => '', 'no_more_data' => 0); $page = $_REQUEST['page']; $args = unserialize(stripslashes($_REQUEST['data'])); $vars = unserialize(stripslashes($_REQUEST['vars'])); if ($page > 0 && is_array($args) && is_array($vars)) { extract($vars); $args['page'] = $page; $args['paged'] = $page; $args['ignore_sticky_posts'] = 1; $args['posts_per_page'] = $vars['ppp']; if (!isset($wp_query)) { $wp_query = new WP_Query($args); } else { query_posts($args); } $per_page = count($wp_query->posts); $response['no_more_data'] = $page >= $wp_query->max_num_pages; //$per_page < $ppp; $post_number = 0; $accent_color = ''; $response['data'] = ''; $post_cats = array(); while (have_posts()) { the_post(); $post_number++; $post_data = getPostData(array('thumb_size' => $blog_style, 'parent_cat_id' => $parent_cat_id, 'sidebar' => !in_array($show_sidebar_main, array('none', 'fullwidth')), 'accent_color' => $accent_color, 'thumb_size' => $thumb_size)); $post_id = $post_data['post_id']; $terms = getCategoriesByPostId($post_id); if (count($terms) != 0) { foreach ($terms as $term) { $post_cats[$term['term_id']] = $term['name']; } } $accent_color = $post_data['post_accent_color']; $response['data'] .= showPostLayout(array('layout' => $blog_style, 'show' => false, 'number' => $post_number, 'add_view_more' => true, 'posts_on_page' => $per_page, 'thumb_size' => $thumb_size, 'thumb_size' => $thumb_size, 'excerpt_length' => $excerpt_length, 'sidebar' => !in_array($show_sidebar_main, array('none', 'fullwidth')), 'iso_columns' => $iso_columns), $post_data); } $response['cats'] = $post_cats; } else { $response['error'] = __('Wrong query arguments', 'themerex'); } echo json_encode($response); die; }
<?php } ?> <section class="masonry grid portfolioNOspacing <?php echo get_custom_option('show_filters') == 'yes' ? 'isotope' : 'isotopeNOanim'; ?> "> <?php } } } while (have_posts()) { the_post(); $post_number++; $post_args = array('layout' => in_array(themerex_substr($blog_style, 0, 7), array('classic', 'masonry', 'portfol')) ? themerex_substr($blog_style, 0, 7) : themerex_substr($blog_style, 0, 7), 'number' => $post_number, 'add_view_more' => false, 'posts_on_page' => $per_page, 'thumb_size' => $blog_style, 'thumb_crop' => themerex_strpos($blog_style, 'masonry') === false, 'strip_teaser' => false, 'parent_cat_id' => $parent_cat_id, 'sidebar' => !in_array($show_sidebar_main, array('none', 'fullwidth')), 'filters' => get_custom_option('show_filters') == 'yes' ? get_custom_option('filter_taxonomy') : '', 'hover' => '', 'hover_dir' => ''); $post_data = getPostData($post_args); showPostLayout($post_args, $post_data); if (get_custom_option('show_filters') == 'yes') { if (get_custom_option('filter_taxonomy') == 'tags') { // Use tags as filter items if (count($post_data['post_tags_list']) > 0) { foreach ($post_data['post_tags_list'] as $tag) { $flt_ids[$tag->term_id] = $tag->name; } } } } } if (!$post_number) { if (is_search()) { showPostLayout(array('layout' => 'no-search-results'), false);
function getQueryData($name) { $ret = getPostData($name); if ($ret != null) { return $ret; } return getGetData($name); }
<?php require_once 'startup.php'; $projectName = getGet("projectName"); if (getPostData("formId") == "rollbackVersionedProject" && getPostData("action") == ecgettext("OK")) { $comment = getPostData("comment"); if ($comment == "") { Error::formError(ecgettext("A commit comment is required."), "comment"); } $version = getPostData("version"); $updateManager = new UpdateManager(); $update = $updateManager->createUpdate("runProcedure"); $update->addItem("projectName", "/plugins/@PLUGIN_KEY@/project"); $update->addItem("procedureName", "RollbackProjectChanges"); $update->addItem("actualParameter", array("actualParameterName" => "project_name", "value" => $projectName)); $update->addItem("actualParameter", array("actualParameterName" => "version", "value" => $version)); $update->addItem("actualParameter", array("actualParameterName" => "comment", "value" => $comment)); $updateManager->handleUpdates(); $response = $update->getResponse(); $id = $response->get("jobId"); Data::$queries["getJobInfo"] = array("request" => "getJobInfo", "constantArgs" => array("jobId", $id), "result" => "job"); $limit = 10; $i = 0; while (1) { $result = QueryManager::handleQueryNow("getJobInfo"); if ($i == $limit || $result->get("status") == "completed") { break; } sleep(1); $i++; }
/** * Tests server connectivity */ function connectTests() { global $fmdb, $__FM_CONFIG; $return = null; /** Load ssh key for use */ $ssh_key = getOption('ssh_key_priv', $_SESSION['user']['account_id']); $temp_ssh_key = sys_get_temp_dir() . '/fm_id_rsa'; if ($ssh_key) { if (file_exists($temp_ssh_key)) { @unlink($temp_ssh_key); } $ssh_key_loaded = @file_put_contents($temp_ssh_key, $ssh_key); @chmod($temp_ssh_key, 0400); } $ssh_user = getOption('ssh_user', $_SESSION['user']['account_id']); /** Get server list */ $result = basicGetList('fm_' . $__FM_CONFIG[$_SESSION['module']]['prefix'] . 'servers', 'server_name', 'server_'); /** Process server list */ $num_rows = $fmdb->num_rows; $results = $fmdb->last_result; for ($x = 0; $x < $num_rows; $x++) { $return .= sprintf(__("Running tests for %s\n"), $results[$x]->server_name); /** ping tests */ $return .= "\t" . str_pad(__('Ping:'), 15); if (pingTest($results[$x]->server_name)) { $return .= __('success'); } else { $return .= __('failed'); } $return .= "\n"; /** remote port tests */ $return .= "\t" . str_pad(__('Remote Port:'), 15); if ($results[$x]->server_update_method != 'cron') { if (socketTest($results[$x]->server_name, $results[$x]->server_update_port, 10)) { $return .= __('success') . ' (tcp/' . $results[$x]->server_update_port . ")\n"; if ($results[$x]->server_update_method == 'ssh') { $return .= "\t" . str_pad(__('SSH Login:'******'no SSH key defined'); } elseif ($ssh_key_loaded === false) { $return .= sprintf(__('could not load SSH key into %s'), $temp_ssh_key); } elseif (!$ssh_user) { $return .= __('no SSH user defined'); } else { exec(findProgram('ssh') . " -t -i {$temp_ssh_key} -o 'StrictHostKeyChecking no' -p {$results[$x]->server_update_port} -l {$ssh_user} {$results[$x]->server_name} uptime", $post_result, $retval); if ($retval) { $return .= __('ssh key login failed'); } else { $return .= __('success'); } } } else { /** php tests */ $return .= "\t" . str_pad(__('http page:'), 15); $php_result = getPostData($results[$x]->server_update_method . '://' . $results[$x]->server_name . '/' . $_SESSION['module'] . '/reload.php', null); if ($php_result == 'Incorrect parameters defined.') { $return .= __('success'); } else { $return .= __('failed'); } } } else { $return .= __('failed') . ' (tcp/' . $results[$x]->server_update_port . ')'; } } else { $return .= __('skipping (host updates via cron)'); } $return .= "\n"; /** dns tests */ $return .= "\t" . str_pad(__('DNS:'), 15); $port = 53; if (socketTest($results[$x]->server_name, $port, 10)) { $return .= __('success') . ' (tcp/' . $port . ')'; } else { $return .= __('failed') . ' (tcp/' . $port . ')'; } $return .= "\n"; $return .= "\n"; } @unlink($temp_ssh_key); return $return; }
if ($post_data['post_format'] != '' && $post_data['post_format'] != 'standard') { $args['tax_query'] = array(array('taxonomy' => 'post_format', 'field' => 'slug', 'terms' => 'post-format-' . $post_data['post_format'])); } $args = addSortOrderInQuery($args, get_custom_option('post_related_sort'), get_custom_option('post_related_order')); $recent_posts = wp_get_recent_posts($args, OBJECT); if (is_array($recent_posts) && count($recent_posts) > 0) { ?> <section class="related_posts<?php echo get_custom_option("show_post_comments") == 'yes' ? ' divider' : ''; ?> "> <h2><?php _e('Related posts', 'themerex'); ?> </h2> <div class="relatedPostWrap"> <div class="columnsWrap"> <?php $i = 0; foreach ($recent_posts as $recent) { $i++; showPostLayout(array('layout' => 'related', 'number' => $i, 'add_view_more' => false, 'posts_on_page' => get_custom_option('post_related_count')), getPostData(array('thumb_size' => 'image_medium', 'strip_teaser' => false, 'sidebar' => !in_array(get_custom_option('show_sidebar_main'), array('none', 'fullwidth'))), $recent)); } ?> </div> </div> <div class="sc_divider"></div> </section> <?php } }
$args['category__in'] = $post_data['post_categories_ids']; } // Uncomment this section if you want filter related posts on post formats if ($post_data['post_format'] != '' && $post_data['post_format'] != 'standard') { $args['tax_query'] = array(array('taxonomy' => 'post_format', 'field' => 'slug', 'terms' => 'post-format-' . $post_data['post_format'])); } $args = addSortOrderInQuery($args, get_custom_option('post_related_sort'), get_custom_option('post_related_order')); $recent_posts = wp_get_recent_posts($args, OBJECT); if (is_array($recent_posts) && count($recent_posts) > 0) { ?> <section class="related"> <h3><?php _e('Related posts', 'themerex'); ?> </h3> <div class="sc_columns_<?php echo esc_attr($columns); ?> postBox"> <?php $i = 0; foreach ($recent_posts as $recent) { $i++; showPostLayout(array('layout' => 'related', 'number' => $i, 'add_view_more' => false, 'posts_on_page' => get_custom_option('post_related_count')), getPostData(array('thumb_size' => getThumbColumns('cub', $columns), 'strip_teaser' => false, 'sidebar' => !in_array(get_custom_option('show_sidebar_main'), array('none', 'fullwidth')), 'categories_list' => true), $recent)); } ?> </div> </section> <?php } }
function buildServerConfig($serial_no) { global $fmdb, $__FM_CONFIG, $fm_name; /** Check serial number */ basicGet('fm_' . $__FM_CONFIG[$_SESSION['module']]['prefix'] . 'servers', sanitize($serial_no), 'server_', 'server_serial_no'); if (!$fmdb->num_rows) { return sprintf('<p class="error">%s</p>', __('This server is not found.')); } $server_details = $fmdb->last_result; extract(get_object_vars($server_details[0]), EXTR_SKIP); $response = null; switch ($server_update_method) { case 'cron': if ($action == 'buildconf') { /* set the server_update_config flag */ setBuildUpdateConfigFlag($serial_no, 'conf', 'update'); $response = sprintf('<p>%s</p>' . "\n", __('This server will be updated on the next cron run.')); } else { $response = sprintf('<p>%s</p>' . "\n", __('This server receives updates via cron - please manage the server manually.')); } break; case 'http': case 'https': /** Test the port first */ if (!socketTest($server_name, $server_update_port, 10)) { return sprintf('<p class="error">%s</p>' . "\n", sprintf(__('Failed: could not access %s using %s (tcp/%d).'), $server_name, $server_update_method, $server_update_port)); } /** Remote URL to use */ $url = $server_update_method . '://' . $server_name . ':' . $server_update_port . '/' . $_SESSION['module'] . '/reload.php'; /** Data to post to $url */ $post_data = array('action' => 'buildconf', 'serial_no' => $server_serial_no); $post_result = @unserialize(getPostData($url, $post_data)); if (!is_array($post_result)) { /** Something went wrong */ if (empty($post_result)) { return sprintf('<p class="error">%s</p>', sprintf(__('It appears %s does not have php configured properly within httpd or httpd is not running.'), $server_name)); } return $response . '<p class="error">' . $post_result . '</p>' . "\n"; } else { if (count($post_result) > 1) { $response .= '<textarea rows="7" cols="100">'; /** Loop through and format the output */ foreach ($post_result as $line) { $response .= "[{$server_name}] {$line}\n"; } $response .= "</textarea>\n"; } else { $response .= "<p>[{$server_name}] " . $post_result[0] . '</p>'; } } break; case 'ssh': /** Test the port first */ if (!socketTest($server_name, $server_update_port, 10)) { return sprintf('<p class="error">%s</p>' . "\n", sprintf(__('Failed: could not access %s using %s (tcp/%d).'), $server_name, $server_update_method, $server_update_port)); } /** Get SSH key */ $ssh_key = getOption('ssh_key_priv', $_SESSION['user']['account_id']); if (!$ssh_key) { return sprintf('<p class="error">%s</p>' . "\n", sprintf(__('Failed: SSH key is not <a href="%s">defined</a>.'), getMenuURL(_('General')))); } $temp_ssh_key = sys_get_temp_dir() . '/fm_id_rsa'; if (file_exists($temp_ssh_key)) { @unlink($temp_ssh_key); } if (@file_put_contents($temp_ssh_key, $ssh_key) === false) { return sprintf('<p class="error">%s</p>' . "\n", sprintf(__('Failed: could not load SSH key into %s.'), $temp_ssh_key)); } @chmod($temp_ssh_key, 0400); $ssh_user = getOption('ssh_user', $_SESSION['user']['account_id']); if (!$ssh_user) { return sprintf('<p class="error">%s</p>' . "\n", sprintf(__('Failed: SSH user is not <a href="%s">defined</a>.'), getMenuURL(_('General')))); } /** Test SSH authentication */ exec(findProgram('ssh') . " -t -i {$temp_ssh_key} -o 'StrictHostKeyChecking no' -p {$server_update_port} -l {$ssh_user} {$server_name} 'ls /usr/local/{$fm_name}/{$_SESSION['module']}/fw.php'", $post_result, $retval); if ($retval) { /** Something went wrong */ @unlink($temp_ssh_key); return sprintf('<p class="error">%s</p>' . "\n", __('Could not login via SSH.')); } unset($post_result); /** Run build */ exec(findProgram('ssh') . " -t -i {$temp_ssh_key} -o 'StrictHostKeyChecking no' -p {$server_update_port} -l {$ssh_user} {$server_name} 'sudo php /usr/local/{$fm_name}/{$_SESSION['module']}/fw.php {$action} " . implode(' ', $options) . "'", $post_result, $retval); @unlink($temp_ssh_key); if ($retval) { /** Something went wrong */ return '<p class="error">' . ucfirst($friendly_action) . ' failed.</p>' . "\n"; } else { if (!count($post_result)) { $post_result[] = ucfirst($friendly_action) . ' was successful.'; } if (count($post_result) > 1) { $response .= '<textarea rows="4" cols="100">'; /** Loop through and format the output */ foreach ($post_result as $line) { $response .= "[{$server_name}] {$line}\n"; } $response .= "</textarea>\n"; } else { $response .= "<p>[{$server_name}] " . $post_result[0] . '</p>'; } } break; } /* reset the server_build_config flag */ if (!strpos($response, strtolower('failed'))) { setBuildUpdateConfigFlag($serial_no, 'no', 'build'); } $tmp_name = getNameFromID($serial_no, 'fm_' . $__FM_CONFIG[$_SESSION['module']]['prefix'] . 'servers', 'server_', 'server_serial_no', 'server_name'); addLogEntry(ucfirst($friendly_action) . " was performed on server '{$tmp_name}'."); return $response; }
<?php $url = $_REQUEST["url"]; if (!$url) { echo "You need to pass in a target URL."; return; } $response = ""; switch (getMethod()) { case 'POST': $response = makePostRequest(getPostData(), $url); break; case 'PUT': $response = makePutRequest(getPutOrDeleteData($url), $url); break; case 'DELETE': $response = makeDeleteRequest($url); break; case 'GET': $response = makeGetRequest($url); break; default: echo "This proxy only supports POST, PUT, DELETE AND GET REQUESTS."; return; } echo $response; function getMethod() { return $_SERVER["REQUEST_METHOD"]; } function getPostData()