From d0ff6a56e7a5d2da42d8a83269ee83f04a74d7b0 Mon Sep 17 00:00:00 2001 From: dtompkins Date: Thu, 22 Jul 2010 00:26:01 -0700 Subject: [PATCH] removed savepref_include_files --- fbcmd.php | 65 +++++++++++++++++++++++++------------------------------ 1 file changed, 29 insertions(+), 36 deletions(-) diff --git a/fbcmd.php b/fbcmd.php index 424aec6..bdc0ff5 100644 --- a/fbcmd.php +++ b/fbcmd.php @@ -53,7 +53,7 @@ // // //////////////////////////////////////////////////////////////////////////////// - $fbcmdVersion = '1.0-beta3-dev16-unstable1'; + $fbcmdVersion = '1.0-beta4-dev1'; //////////////////////////////////////////////////////////////////////////////// @@ -188,7 +188,6 @@ AddPreference('print_wrap_width','80','col'); AddPreference('quiet','0','q'); AddPreference('restatus_comment_new','1'); - AddPreference('savepref_include_files','0','spf'); AddPreference('show_id','0','id'); AddPreference('status_dateformat','D M d H:i','stdf'); AddPreference('status_show_date','0','std'); @@ -311,11 +310,6 @@ } } - // STEP FIVE: convert all [datadir] refs to $fbcmdBaseDir - foreach ($fbcmdPrefs as $key=>$value) { - $fbcmdPrefs[$key] = str_replace('[datadir]',$fbcmdBaseDir,$value); - } - //////////////////////////////////////////////////////////////////////////////// if ($fbcmdCommand == 'SAVEPREF') { @@ -377,7 +371,7 @@ AddCommand('NSEND', 'flist message~Send a notification message to friend(s)'); AddCommand('OPICS', 'flist [savedir]~List [and optionally save] all photos owned by friend(s)'); AddCommand('PINBOX', '[count|unread|new]~Display the inbox (latest updates) from pages you are a fan of'); - AddCommand('PPOST', 'page_id [POST parameters]~Post a message to a your page (for page owner owners)'); + AddCommand('PPOST', 'page_id [POST parameters]~Post a message to a your page (for page administrators)'); AddCommand('POST', 'message <[name] [link] [caption] [description]>~IMG message img_src [img_link] <[n] [l] [c] [d]>~MP3 message mp3_src [title] [artist] [album] <[n] [l] [c] [d]>~FLASH swf_src img_src <[n] [l] [c] [d]>~Post (share) a story (or media) in your stream'); AddCommand('PPICS', '[flist] [savedir]~List [and optionally save] all profile photos of friend(s)'); AddCommand('RECENT', '[flist] [count]~Shows the [count] most recent friend status updates'); @@ -538,14 +532,16 @@ //////////////////////////////////////////////////////////////////////////////// + $fbcmdKeyFileName = str_replace('[datadir]',$fbcmdBaseDir,$fbcmdPrefs['keyfile']); + if ($fbcmdCommand == 'RESET') { ValidateParamCount(0); - VerifyOutputDir($fbcmdPrefs['keyfile']); - if (@file_put_contents($fbcmdPrefs['keyfile'],"EMPTY\nEMPTY\n# only the first two lines of this file are read\n# use fbcmd RESET to replace this file\n") == false) { - FbcmdFatalError("Could not generate keyfile {$fbcmdPrefs['keyfile']}"); + VerifyOutputDir($fbcmdKeyFileName); + if (@file_put_contents($fbcmdKeyFileName,"EMPTY\nEMPTY\n# only the first two lines of this file are read\n# use fbcmd RESET to replace this file\n") == false) { + FbcmdFatalError("Could not generate keyfile {$fbcmdKeyFileName}"); } if (!$fbcmdPrefs['quiet']) { - print "keyfile {$fbcmdPrefs['keyfile']} has been RESET\n"; + print "keyfile {$fbcmdKeyFileName} has been RESET\n"; } } @@ -562,9 +558,9 @@ } $fbcmdUserSessionKey = $session['session_key']; $fbcmdUserSecretKey = $session['secret']; - VerifyOutputDir($fbcmdPrefs['keyfile']); - if (@file_put_contents ($fbcmdPrefs['keyfile'],"{$fbcmdUserSessionKey}\n{$fbcmdUserSecretKey}\n# only the first two lines of this file are read\n# use fbcmd RESET to replace this file\n") == false) { - FbcmdFatalError("Could not generate keyfile {$fbcmdPrefs['keyfile']}"); + VerifyOutputDir($fbcmdKeyFileName); + if (@file_put_contents ($fbcmdKeyFileName,"{$fbcmdUserSessionKey}\n{$fbcmdUserSecretKey}\n# only the first two lines of this file are read\n# use fbcmd RESET to replace this file\n") == false) { + FbcmdFatalError("Could not generate keyfile {$fbcmdKeyFileName}"); } try { $fbObject->api_client->session_key = $fbcmdUserSessionKey; @@ -584,20 +580,20 @@ //////////////////////////////////////////////////////////////////////////////// - if (!file_exists($fbcmdPrefs['keyfile'])) { + if (!file_exists($fbcmdKeyFileName)) { print "\n"; print "Welcome to fbcmd! [version $fbcmdVersion]\n\n"; print "It appears to be the first time you are running the application\n"; - print "as fbcmd could not locate your keyfile: [{$fbcmdPrefs['keyfile']}]\n\n"; + print "as fbcmd could not locate your keyfile: [{$fbcmdKeyFileName}]\n\n"; ShowAuth(); return; } //////////////////////////////////////////////////////////////////////////////// - $fbcmdKeyFile = file($fbcmdPrefs['keyfile'],FILE_IGNORE_NEW_LINES); + $fbcmdKeyFile = file($fbcmdKeyFileName,FILE_IGNORE_NEW_LINES); if (count($fbcmdKeyFile) < 2) { - FbcmdFatalError("Invalid keyfile {$fbcmdPrefs['keyfile']}"); + FbcmdFatalError("Invalid keyfile {$fbcmdKeyFileName}"); } $fbcmdUserSessionKey = $fbcmdKeyFile[0]; $fbcmdUserSecretKey = $fbcmdKeyFile[1]; @@ -2958,12 +2954,14 @@ function LaunchBrowser($url) { function LoadDataFile($prefSave, $prefFile) { global $fbcmdPrefs; + global $fbcmdBaseDir; + $fileName = str_replace('[datadir]',$fbcmdBaseDir,$fbcmdPrefs[$prefFile]); $loadData = array('0'); if ($fbcmdPrefs[$prefSave]) { - if (!file_exists($fbcmdPrefs[$prefFile])) { - FbcmdWarning("Could not locate {$prefFile} [{$fbcmdPrefs[$prefFile]}]"); + if (!file_exists($fileName)) { + FbcmdWarning("Could not locate {$prefFile} [{$fileName}]"); } else { - $loadData = unserialize(@file_get_contents($fbcmdPrefs[$prefFile])); + $loadData = unserialize(@file_get_contents($fileName)); } } return($loadData); @@ -3757,11 +3755,13 @@ function SaveAlbumData($obj) { //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// - function SaveDataFile($prefSave, $prefFile,$saveData) { + function SaveDataFile($prefSave, $prefFile, $saveData) { global $fbcmdPrefs; + global $fbcmdBaseDir; + $fileName = str_replace('[datadir]',$fbcmdBaseDir,$fbcmdPrefs[$prefFile]); if ($fbcmdPrefs[$prefSave]) { - if (@file_put_contents($fbcmdPrefs[$prefFile],serialize($saveData)) == false) { - FbcmdWarning("Could not generate {$prefFile} {$fbcmdPrefs[$prefFile]}"); + if (@file_put_contents($fileName,serialize($saveData)) == false) { + FbcmdWarning("Could not generate {$prefFile} {$fileName}"); } } } @@ -3886,20 +3886,13 @@ function SavePrefs($fileName) { // If you modify this, copy it to fbcmd_update.php function SavePrefsContents() { global $fbcmdPrefs; - if (isset($fbcmdPrefs['savepref_include_files'])) { - $includeFiles = $fbcmdPrefs['savepref_include_files']; - } else { - $includeFiles = false; - } $fileContents = " $switchValue) { if ($switchKey != 'prefs') { - if (($includeFiles)||(($switchKey != 'keyfile')&&($switchKey != 'albumfile')&&($switchKey != 'eventfile')&&($switchKey != 'mailfile')&&($switchKey != 'noticefile')&&($switchKey != 'postfile'))) { - if (strpos($switchKey,'mkdir_mode') === false) { - $fileContents .= " \$fbcmdPrefs['{$switchKey}'] = " . var_export($switchValue,true) . ";\n"; - } else { - $fileContents .= " \$fbcmdPrefs['{$switchKey}'] = 0" . decoct($switchValue) . ";\n"; - } + if (strpos($switchKey,'mkdir_mode') === false) { + $fileContents .= " \$fbcmdPrefs['{$switchKey}'] = " . var_export($switchValue,true) . ";\n"; + } else { + $fileContents .= " \$fbcmdPrefs['{$switchKey}'] = 0" . decoct($switchValue) . ";\n"; } } }